Reputation: 3936
The connection string generated by entity framework looks like this.
<add name="ETestEntities" connectionString="metadata=res://*/Models.TestModel.csdl|res://*/Models.TestModel.ssdl|res://*/Models.TestModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=bogus\sqlexpress;Initial Catalog=ETest;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
I ftp deployed the application, created the database(i named it ETest) and created an user. The instruction i got is:
In order to connect to SQL Server 2008 from Management Studio, Enterprise Manager, Query Analyzer or other client software you can use the following SQL Server address:
1.2.3.4
You may also use SQL Server address above in your application connection strings, for example:
Classic ASP (ADO Library) Provider=SQLOLEDB;Data source=1.2.3.4;Initial catalog=databaseName;User Id=userName;Password=password;
ASP.NET (ADO.NET Library) Server=1.2.3.4;Database=databaseName;Uid=userName;Password=password;
I tried the following from www.connectionstrings.com
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
How do i have to modify the connection string to make it work?
It seems to work like this:
Connection string: Data Source=dataSource;Network Library=dbmssocn;Connection Timeout=15;Packet Size=4096;Integrated Security=no;User ID=user;Password=pass;Encrypt=no;
Connection timeout: 15
Database: ETest
Datasource: dataSource
Network packet size: 4096
Server version: 10.00.4311
Work station id: WIN-HS1ITVC2D4K
Upvotes: 1
Views: 891
Reputation: 109035
With Entity Framework there is an extra abstraction1 going on. The connection string generated for you, with a couple of added line breaks:
metadata=res://*/Models.TestModel.csdl|res://*/Models.TestModel.ssdl|res://*/Models.TestModel.msl; provider=System.Data.SqlClient; provider connection string="Data Source=bogus\sqlexpress;Initial Catalog=ETest;Integrated Security=True;MultipleActiveResultSets=True"
can be seen to contain a provider connection string
property, the value of this property is the "normal" connection string (undoing the XML escapes):
"Data Source=bogus\sqlexpress;Initial Catalog=ETest;Integrated Security=True;MultipleActiveResultSets=True";
You need to replace the value of the Data Source
and Initial Catalog
properties of this inner connection string.
1 Essentially the EF connection string is telling the EF runtime where to get the model (from resources in an assembly) to create the in-memory model, what EF provider to use, and what connection string to pass to that provider – and it is this last piece that you need to adjust when the server, instance or database changes.
Upvotes: 1
Reputation: 61812
While not a direct answer to your question, this site is useful for almost any connection string question: http://www.connectionstrings.com/.
At the risk of sounding like a commercial: It's your one-stop-shop for connection strings!
Upvotes: 2
Reputation: 1426
Try it like this:
Provider=SQLNCLI10;SERVER=myServerAddress;DataTypeCompatibility=80;Database=myDataBase;User Id=myUsername;Password=myPassword
Hope this helps.
Upvotes: 0