Connection string for database on another comouter
-
HI. I am currently working on a database application. I use Sql express studio to model the database and then use LINQ in c# to access it. Whereas everything is great , the thing is that the database is on the same laptop where there is the application to access it. Let say this laptop name is "A". i use the connection string connString = @"server = .\sqlexpress;integrated security = true;database = Whatever"; (YES i am using Winodws authenciation) But if i want to access database on a different Laptop from the application running on "A", what will be the connection string?? I will connect the Both Laptops through their own WIFI.
-
HI. I am currently working on a database application. I use Sql express studio to model the database and then use LINQ in c# to access it. Whereas everything is great , the thing is that the database is on the same laptop where there is the application to access it. Let say this laptop name is "A". i use the connection string connString = @"server = .\sqlexpress;integrated security = true;database = Whatever"; (YES i am using Winodws authenciation) But if i want to access database on a different Laptop from the application running on "A", what will be the connection string?? I will connect the Both Laptops through their own WIFI.
When connecting to remote database you replace the server name. Currently you use dot to tell that the server is local. In case of remote server you would have a connection string like:
server=servername\instancename;integrated security...
Have a look at this site: http://www.connectionstrings.com/sql-server-2005[^]
The need to optimize rises from a bad design.My articles[^]
-
When connecting to remote database you replace the server name. Currently you use dot to tell that the server is local. In case of remote server you would have a connection string like:
server=servername\instancename;integrated security...
Have a look at this site: http://www.connectionstrings.com/sql-server-2005[^]
The need to optimize rises from a bad design.My articles[^]
I guess i have to use one of the connection string mentioned:- someting like. Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword; I want to know . how to know ip of one computer?? what is network library?? and i am using sql express studio 2008 r2 on both computers. So where is the keyword /sqlexpress is to be used?
-
I guess i have to use one of the connection string mentioned:- someting like. Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword; I want to know . how to know ip of one computer?? what is network library?? and i am using sql express studio 2008 r2 on both computers. So where is the keyword /sqlexpress is to be used?
You don't have to know the IP address, you can use names instead. \SQLEXPRESS isn't a keyword, it's the name of the SQL Server instance. For example if I have a server called Machine1 and I have two different instances of SQL Server in that server; Production and Test. Now if I want to connect to the Test-instance of SQL Server, I'd use a connection string like:
Data Source=Machine1\Test;...
Perhaps the easiest way to see locally the name of the instance is to open Control Panel and look at services. The instance name is in parenthesis on the service name.
The need to optimize rises from a bad design.My articles[^]
-
You don't have to know the IP address, you can use names instead. \SQLEXPRESS isn't a keyword, it's the name of the SQL Server instance. For example if I have a server called Machine1 and I have two different instances of SQL Server in that server; Production and Test. Now if I want to connect to the Test-instance of SQL Server, I'd use a connection string like:
Data Source=Machine1\Test;...
Perhaps the easiest way to see locally the name of the instance is to open Control Panel and look at services. The instance name is in parenthesis on the service name.
The need to optimize rises from a bad design.My articles[^]
-
oh ok..i am getting it.. so my final connection string will look something like this ? server=computername\instancename ; integrated security = false ; database = "whatever" ; user id = sa ; Password=pass;
-
Exactly :)
The need to optimize rises from a bad design.My articles[^]
I am trying to do it from a different laptop , which is on the same network... But it gives error when i try to connect through sql express studio....... error 26 A network or instance-specific error occured while esablishing a connection to sql server..it might be not found or accesible................is there any other setting i am missing??? and how to make sure that both computers are properly connected over the network?
-
I am trying to do it from a different laptop , which is on the same network... But it gives error when i try to connect through sql express studio....... error 26 A network or instance-specific error occured while esablishing a connection to sql server..it might be not found or accesible................is there any other setting i am missing??? and how to make sure that both computers are properly connected over the network?
There are several possibilities. First try to ping the other machine with the name you have specified in the connection string. If that's ok, check the firewall settings on both ends (you can disable Windows firewall for a while just to test the connection) etc. Here's one quite good walkthrough for SQL Server 2005: http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/[^]
The need to optimize rises from a bad design.My articles[^]
-
There are several possibilities. First try to ping the other machine with the name you have specified in the connection string. If that's ok, check the firewall settings on both ends (you can disable Windows firewall for a while just to test the connection) etc. Here's one quite good walkthrough for SQL Server 2005: http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/[^]
The need to optimize rises from a bad design.My articles[^]
thanks for you link.. But i had sql 2008 , so it had different settings. http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/[^] that link was for 2008 , seems like the browser setting had problems ::) it was turned off. . but in the end it all worked out! You were a great help!, i learned many things!! Thanks for your support!
-
thanks for you link.. But i had sql 2008 , so it had different settings. http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/[^] that link was for 2008 , seems like the browser setting had problems ::) it was turned off. . but in the end it all worked out! You were a great help!, i learned many things!! Thanks for your support!