Sql server express connection string

Is there a difference between the sql server connection string and the vesion expression ?!

+7
sql-server
source share
6 answers

By default (although I do not recommend it 1 ), Sql Express is installed as a named instance . This means that you must connect as Server=servername.com\SQLEXPRESS , and not just Server=servername.com .

As always, connectionstrings.com has advantages.

1 I do not recommend named instances because they work on a different port , which is what the PITA firewall does. In addition, it makes no sense for me to run more than one MSSQL server on a computer if you can just host multiple databases instead, so I don’t sure what is the matter.

+10
source share

Connection string used to access SQL Server and SQL Server Express?

Generally not. This is a good thing about using Express; develop with it locally and with minimal changes transfer data access to SQL Server.

+1
source share

The only difference is that you will need to specify a named instance in the conn line if Express was configured this way. In 2005 there was no choice, but 2008.

 Data Source=localhost\SQLExpress 

Here's a great link for connection strings .

0
source share

Yes, there is a difference - the biggest one is the lack of AttachDbFilename in the full SQL Server.

SQL Server Express Connection String:

 Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes; 

Typical normal SQL Server connection string:

 Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI; 

See connectionStrings.com for more information.

0
source share

I recently downloaded a sample application from the Telerik website and was unable to run it on my machine, on which only Developer Server SP1 for SQL Server 2008 is installed, until I found and replaced all "User instance = True" with "User instance = False" .

Before anyone goes and earns their panties, everyone wriggles in a knot, first listen to me. My circumstances may be (but should not be) unique in that, instead of installing SQL Server 2008 Express, just to run sample applications (such as Telerik), I just installed a second named instance of SQL Server, which you guessed is sqlexpress on my copy of SQL Server 2008 Developer Edition. Thus, when the Telerik demo application (or you call it) tries to connect to "Data Source =. \ Sqlexpress", then there is nothing wiser that what it really connects is also a "big SQL Server" (this is what SQL Server Developer Edition for the purposes of this publication).

The key conecpts (I dare say "cash quote") that you need to understand are as follows:

SQL Express permits (actually accepts, if absent) User Instance = True, so if you run a named instance of sqlexpress with "large SQL" (Developer, Standard, Enterprise or Data Center), you just need to find / replace User Instance = True with Custom instance = False in the connection string and your worries are done. Even the "Attach Database" material (which I see in the Telerik connectionStrings connection section of your web.config) works with "big SQL" (contrary to what someone posted earlier in this thread).

Here is an example taken directly from the web.config file of the web.config Telerik file after I “fixed it”:

 <connectionStrings> <add name="NorthwindConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Northwind.mdf;Integrated Security=True;User Instance=False" providerName="System.Data.SqlClient"/> <add name="TelerikConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Telerik.mdf;Integrated Security=True;User Instance=False" providerName="System.Data.SqlClient"/> <add name="NorthwindConnectionString35" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Northwind.mdf;Integrated Security=True;User Instance=False" providerName="System.Data.SqlClient"/> <add name="TelerikConnectionString35" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Telerik.mdf;Integrated Security=True;User Instance=False" providerName="System.Data.SqlClient"/> <add name="NorthwindEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/> <add name="TelerikEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Telerik.mdf;Integrated Security=True;User Instance=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/> <add name="EditorFileBrowserDatabase" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|EditorDBStorage.mdf;Integrated Security=True;User Instance=False" providerName="System.Data.SqlClient"/> </connectionStrings> 
0
source share

In addition to the previous post: If you have problems setting up Telerik samples on MSSQL Server 2008, you can do the following:

  • Open LiveDemos Telerik VS Solution
  • Establish database connections for telerik.mdf files in VS master
  • Copy the connection string to connect to the web.config file
  • And add “Integrated Security = True; User Instance = False” to the end of the lines.

PS. Fred morrison

0
source share

All Articles