Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could not connect to instance of sql server

Status
Not open for further replies.

sweth

IS-IT--Management
Mar 2, 2002
98
IN
I could able to connect default instance of sql server but to another instance i could not connect. I am using the following code to connect
string strcon = @"Data Source=servername\instancename;uid=uid;pwd=pwd;Initial Catalog=pubs";
System.Data.SqlClient.SqlConnection cnn = new System.Data.SqlClient.SqlConnection(strcon);
try
{
cnn.Open();
Response.Write("Connected");
cnn.Close();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}

but
string strcon = @"Data Source=servername;uid=uid;pwd=pwd;Initial Catalog=pubs";

works fine.

Can any one help us?

Thanks
 
Do you have a login on the other instance? Just because you have access to one instance, doesn't mean you have access to all.

-SQLBill

Posting advice: FAQ481-4875
 
Yes i have login for other instance i could able to connect from sql query analyser by using servername/instancename and uid , pwd
thanks for your reply
Siva
 
I never connect the way you are trying to do, but....

Do you use an ODBC connection? Check the TCP Port number. I believe it's different for additional instances.

What error message are you getting? Check not only SQL Server Error logs, but also the Windows Event Viewer logs.

-SQLBill

Posting advice: FAQ481-4875
 
Sorry for posting solution after long time. I found in default instance sp3 was installed and in another instance sp3 was not installed.
It seems sql server running from windows 2003 needs sp3 for client connections in dotnet.

Siva
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top