Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can't connect my VB app to an SQL Server 2005 instance because "server don't exist or access has been denied" (the Conection String is correct because the app works in other networks and also i wrote the server's ip instead his name). However I can connect from the same network with SqlCmd (tcp protocol).

Does anyone knows possible reasons for the error?

Thanks.


Dim StringConexion As String = "Provider=SQLOLEDB;Data Source=server's_ip\myInstance;Initial Catalog=mydb;User ID=myUser;Password=myPassword"


The error message is generated by .NET Framework (it was my spanish translation so myabe you can't recognize it). I will try to translate it better:

Unhandled exception in the application. If you click Continue, the application will ignore this error and attempt to continue. If you click on the application will close out immediately.

[DBNETLIB] [ConnectionOpen (Connect ()).] SQL Server does not exist s Server or denied access.

enter image description here

share|improve this question

closed as off topic by voretaq7 May 7 '13 at 3:03

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
The error message "server don't exist or access has been denied" does not seem to be a standard error message generated by Windows, or the .NET framework. Can you step through your application and get the actual error message? –  Justin Dearing Jan 10 '12 at 14:30
    
And post both the connection string you are using and the SQLCMD parameters. –  Jason Cumberland Jan 10 '12 at 14:52

2 Answers 2

up vote 0 down vote accepted

You can try the following to troubleshoot the error you are getting:

  • Run your application in the VB IDE setting a breakpoint when the database connects. If this is VB 6 you want to look for the Open() method of an instance of the ADO.Connection object. you can then step through the apps behavior to see what is happening.
  • You can Look at the error log on the server. This is on the server's hard drive in a folder similar to C:\Program Files\Microsoft SQL Server\MSSQL10.<instance_name>\MSSQL\Log\ERRORLOG. This will only be useful if the app is actually establishing a connection with the SQL server and there is some kind of authentication error.
  • You can run a packet sniffer like Wireshark and look for connection attempts when the app runs.
share|improve this answer
    
I realized with Wireshark that the app was using port 1434, so I added port 1433 on the string connection. –  sr.u Feb 2 '12 at 9:45

I think this connections can help you

Dim conn As String ="Data Source = Servername in you login to Ms sql server;database = your database; user ID = sa ; password = your password"

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.