July 25, 2011 at 4:46 am
Hi,
I have a web server in Domain A and database server in Domain B.
I am trying to connect Database server (SQL Server 2008) in Domain B using a connection string in VS 2005 in Domain A.
I am using a SQL Server Authentication credentials. I have ensured that the credential is valid for the database and I can connect to the database using the credential.
I got the following error:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I can ping the database server from web server and can connect it using remote desktop.
I can connect the database when I am connecting the database from same domain, i.e. Domain B.
Can anybody please let me know how can I set up a connection from the web server to the database?
July 25, 2011 at 4:57 am
Make sure the Servername and instance name you are giving is correct... Also double check your username and Password are correct... and try giving it like Servername\instancename (If it is Express edition think the default instance name is sqlexpress)... Nxt also try giving the servername as the IP Address...
If nothing works it should be the firewall blocking issue or the port number issue... Disable firewall or open it for the port you use for your instance... You can get the port number for your instance from SQL Server Configuration manager > SQL Server 2005 Network Configuration > Protocols for MSSQLSERVER > Right click on TCP/IP and choose properties > ON IP Address Tab you can get the IP Address and Port number...
Now try giving it like Servername\Instance,PortNumber e.g. Server01\Instance01,1433
This should get it right for you 🙂
July 25, 2011 at 5:38 am
Thanks for your reply.
i have tried to connect using both IP address and servername.
I have also verified the credentials.
Still I am unable to login.
Database server is using default SQL port.
I have tried with to connect with the port number as well.
Still getting error while connecting.
It says "An error while connecting to server"
July 25, 2011 at 5:40 am
For information we do not have any common credentials.
Visual studio is running on a credential of Domain A and SQL server is running on credential of Domain B.
I are trying to connet to the database using a SQL Server credential on Server B.
July 25, 2011 at 5:46 am
Connect to a windows client machine in the same network (any will do). Open a command prompt and try "telnet <IP> <port>" and hit enter. If it opens to an empty window, then you know SQL can take client connections. If not, it insn't listening over TCP/IP.
Also check to see if there is any login failure errors in the errorlogs.
July 25, 2011 at 9:51 am
Thanks Sanz
I will check that tomorrow
July 25, 2011 at 10:40 am
If the domains don't trust each other, I don't think any amount of SQL perms verification will help. Check with your domain admin to make sure that A) the domains trust each other and will allow traffic to flow from one to the other, and B) that the firewall has a port to allow the traffic to go through.
July 25, 2011 at 10:13 pm
With telnet I am able to connect to the SQL port in the database server from web server.
Now how can I make sure that SQL also connects?
When I connect from Server Explorer in VS 2005 it says
"Server could not be found. Make sure server name is correct"
July 25, 2011 at 10:44 pm
I have SQL server 2000 in the web server and when i tried to connect to the SQL 2000 instance from Enterprise manager I am able to connect to the instance. Since 2000 is not compatible with 2008 I am unable to connect to 2008 instance.
but when I am trying to connect from VS 2005 it is not identifying the server.
here are my repro steps for VS 2005
Navigate to
Server Explorer -> Server
Right Click -> Add New Server
Provide the IP address for the server
Click "Connect using a different user name.."
Prove credentials and connect
Please note that I am using the same credentials that I have used to connect from SQL Server Enterprise Manager.
Please let me know how can I connect using VS 2005.
July 25, 2011 at 11:43 pm
use fully qualified server name to connect. I know if IP doesn't work then this is no difference but give it a go...
July 26, 2011 at 12:09 am
first make sure that the domains have trust relation between them. the remote desktop session might have been disabled in the the sql server, check it and use (fully qualified computer name to connect to the sql server)\(instance name).
July 26, 2011 at 7:50 am
Do you have a 2k8 server in the domain that VS2k5 is in? Have you tested the connection that way?
I'm wondering if there's a problem with VS2k5 seeing SQL Server 2008. You may actually need a service pack for Visual Studio or an upgrade. But the only way to be sure about this possibility is to test it locally first.
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply