locked
How to put sql server database to external storage? RRS feed

  • Question

  • Hi all,

    I downloaded, set and connected my desktop app to sql server. Till now I am connecting to server 1. win auth ot 2. server auth. But this databse is on my pc. In office are more colleagues. So If i am not in office they can't connect to database because my PC (laptop) is with me. So I want to put this database on external storage in which are all PC's connected.

    Thanks for your answers.


    Monday, October 12, 2020 12:30 PM

Answers

  • The clients connect to SQL Server, not to the database file. SQL Server manage the file access, so one running, central SQL Server is mandatory.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]


    Monday, October 12, 2020 1:19 PM

All replies

  • NOT just the database storage. You have to put the whole server software (as well as the storage) somewhere all connected PCs can find it. This means that you have to install a "server" (doesn´t have to be a "big" computer, a common PC can be used as a server) into a computer that is always turned on. Then, on that computer, you install SQL Server and the storage that contains the data.

    When you asked your question, you may have had in mind other simpler databases that are based on file storage along with some client DLLs, such as Access. In this case, it is enough to place the storage at a shared location and all PCs can access it. But SQL Server is more complex. The Storage is not enough, you need the Server software that goes along with it.

    Since you asked the question in the C# forum (and not in the SQL Server forum), the thing to know is that from the point of view of your C# code the only thing that you should need to change (assuming that the database transactions are properly written to allow concurrency) is the connection string. You will need to edit the connection string so that it has the required information for connection to the server where you installed your server software and storage. Other than that, your program should continue to work without changes.


    Monday, October 12, 2020 12:47 PM
  • I was using SQLite before. That file.db was stored on external storage (not computer). But problem was when more PC wrote to same database at the same time. So I decided to use sql server. It is perfect, but I am not all time in work (only when I need to programming). 
    Monday, October 12, 2020 1:07 PM
  • The clients connect to SQL Server, not to the database file. SQL Server manage the file access, so one running, central SQL Server is mandatory.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]


    Monday, October 12, 2020 1:19 PM