-1

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

2
  • 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? Jan 10, 2012 at 14:30
  • And post both the connection string you are using and the SQLCMD parameters. Jan 10, 2012 at 14:52

2 Answers 2

0

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.
1
  • I realized with Wireshark that the app was using port 1434, so I added port 1433 on the string connection.
    – sr.u
    Feb 2, 2012 at 9:45
-1

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"

Not the answer you're looking for? Browse other questions tagged .