Where does SQL Change Automation store the connection string to the development database
IbexMark
Posts: 9 New member
We want to make sure that two different users point to the same development database. I would expect that this be stored somewhere within the project and be picked up by our source control (GIT). The only thing that should be different is the user used to connect to the database. Instead I found that when I pulled the latest changes on a different machine, the database connection was different. Now, it appears that I have made a royal mess. The only place I found the connection string was in \obj\projectname.sql. Normally the obj directory is in the .gitignore so it did not go to the repository. Is this connection string stored somewhere else?
Tagged:
Best Answer
-
MikielAgutu Posts: 29 Silver 1Hello Mark
SQL Change Automation stores the connection string in the .sqlproj file for your project. This is under the <DefaultConnectionString> property.
To set the default connection string:- In Visual Studio, right click your project and select properties
- Under the Debug tab, find the 'Target Connection String' box
- Click 'Edit...' and select your development database
- Then click the 'Set As Default' button
However, there may also be a connection string in the .user file for the solution. This will override the default connection string. In order to ensure everyone is using the default connection string from the .sqlproj file:- In project properties, under the Debug tab, find the 'Target Connection String' box
- Click 'Restore Default'
You can then edit the target connection string to use different login credentials for the same DB as defined in the default connection string.
Thanks
Mikiel Agutu | Software Engineer | Redgate Software
Answers
Here is the Default Connection
Here is what shows when I attempt to Change Connection. The database name is not coming from the "Default Connection String" but instead, from the project name