VB can't connect to SQL Server, all other programs and telnet can
Hi! I've and old VB 6 application, that tries to connect to a SQL Server DB (2000 and/or 2005), but it can't. It just keep telling me that "can't establish connection with the Data Base", and that´s it. I'm using VBSQL.OCX function SqlOpenConnection for this.
I've tried other ways to reach the DB, in order to see if it's and external problem but every other test works ok. I've connectet through ODBC, by the SQL Manager of SQL 2008 and 2005, with Java JDBC, and even I did a telnet to the address and the tcp port and it responds OK. I even remove all firewalls, anti-virus and so. I've no idea what to do now :cry:
The .vbp project starts correctly.
Best regards,
Raul
Re: VB can't connect to SQL Server, all other programs and telnet can
You could try the next way (only change for the real names)
Code:
'
Dim MyConStr AS String
Dim MySQL AS ADODB.Connection
'
'
MyConStr = "Provider=SQLOLEDB.1;" & _
"UID=xxx;" & _
"PWD=yyyyyy;" & _
"Persist Security Info=False;" & _
"Initial Catalog=DBNAME;" & _
"Data Source=SERVERNAME"
Set MySQL = New ADODB.Connection
MySQL.CursorLocation = adUseClient
MySQL.ConnectionString = MyConStr
MySQL.Open
MySQL.CommandTimeout = 0
Also, it could be helpful if you visit ---> http://www.connectionstrings.com/
Re: VB can't connect to SQL Server, all other programs and telnet can
Quote:
Originally Posted by
jggtz
You could try the next way (only change for the real names)
Code:
'
Dim MyConStr AS String
Dim MySQL AS ADODB.Connection
'
'
MyConStr = "Provider=SQLOLEDB.1;" & _
"UID=xxx;" & _
"PWD=yyyyyy;" & _
"Persist Security Info=False;" & _
"Initial Catalog=DBNAME;" & _
"Data Source=SERVERNAME"
Set MySQL = New ADODB.Connection
MySQL.CursorLocation = adUseClient
MySQL.ConnectionString = MyConStr
MySQL.Open
MySQL.CommandTimeout = 0
Also, it could be helpful if you visit --->
http://www.connectionstrings.com/
I can't chance anything, because is an old code that is working right now in many PCs, I only need to run it on my computer because I'm migrating it to Java and need to go line by line in the code. I managed to have it running before, but I reinstalled my computer and can't now, and can't figure out what I'm missing (it has been a pain in the ... always to install this thing)