0

When executing integration tests, I'm using a connection string to connect to the database. I know there is a default notation for connecting to the default server instance in a connection string:

data source=.;initial catalog=[database name];integrated security=SSPI;

Unfortunately the database is currently not installed on the default server and due to compatibility issues I am unable to change to the default server. Now for all my tests, I will have to assign the sever name like so:

data source=[My Server name] ;initial catalog=[database name];integrated security=SSPI;

Since the solution is shared, I can't check this configuration in, and I'll have to do a lot of manual maintenance for this.

Is there any way I can change the default SQL Server for my PC, so that I can use the connection string as shown in the first example?

EDIT:

I was able to successfully use the following connection string:

data source=.\SQLEXPRESS;initial catalog=[database name];integrated security=SSPI;

EDIT 2:

I was able to resolve my issue by this awnser

3 Answers 3

1

I managed to resolve the issue by following the steps in this post: https://stackoverflow.com/a/11921896/1829773

Sign up to request clarification or add additional context in comments.

Comments

0

To change the default server, do:

sp_dropserver <old_name>;  
GO  
sp_addserver <new_name>, local;  
GO  

Comments

0

you can try this :

  sp_dropserver 'your server name'>;  
  GO  
  sp_addserver '.', local;  
  GO  

You can change your connection string to :

data source=.;initial catalog=[database name];integrated security=True;

This will not disturb other developpers.

7 Comments

This did change the name,but i still can't connect to it using the default connection string
What is the error ? may be SSPI ? Can you share the error message ?
There is no error message. I Can update the name, but the connection string still fails. When i run sp_helpserver i see the name and network name have been changed
Changing the integrated security from SSPI to TRUE didn't change how it worked. I still can't connect when I use the . as datasource, and I can connect when I use the server name.
I want to say, what is the error when you try to connect. Server not found ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.