user3599540
user3599540

Reputation: 35

Cannot connect to SQL Server 2012 (connection string issue?)

I have been searching through SO and found a connection string that seems to be what I need.

However, it does not work.

I use SQL Server 2012 Express and I need my application to connect (with no credentials). I am using the following con.string:

Server=(localdb)\\SQLEXPRESS;Database=MyDB;Trusted_Connection=Yes;

However, the server does not respond.

Upvotes: 1

Views: 69

Answers (1)

marc_s
marc_s

Reputation: 755297

You need to either use the proper SQL Server Express - then use this connection string:

server=(local)\\SQLEXPRESS;Database=MyDB;Integrated Security=SSPI;

(use just (local) - not (localdb))

or you use LocalDB (which is a "run-on-demand" version of SQL Server Express), in that case, use:

server=(localdb)\\v11.0;Database=MyDB;Integrated Security=SSPI;

The difference:

  • SQL Server Express proper is a server-based solution, which is installed and runs as a Windows service all the time

  • SQL Server Express LocalDB is a run-on-demand version of SQL Server Express, which only gets started up when you need it (e.g. in debugging inside Visual Studio 2012/2013)

Upvotes: 1

Related Questions