Link to home
Start Free TrialLog in
Avatar of fylix0000
fylix0000

asked on

Script to test an ODBC connection?

I am not sure if this is the right place to ask but here goes:

I have a user who manually setup a System DSN  ODBC connection for SQL 2000.

I can only as for a name of that connection such as "ODBC_SQL", this name is the DSN configuration for SQL 2000 that he allready stated the server, the user name and password and which database to connect to in the setting.

He is running window 2000.
I know the driver he use is " sun.jdbc.odbc.JdbcOdbcDriver",
I am unsure but the URL can be "jdbc:odbc:ODBC_SQL "

Is there a vb script that I can use to connect to his datbase to test if certain table exists? so that when I run the script, if the table exists then I get a pop up message saying good connection, else saying bad connection?
SOLUTION
Avatar of g_johnson
g_johnson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fylix0000
fylix0000

ASKER

I save it as test.vbs and run but got the error

Line: 1
Char: 8
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error.

Sorry if I sound clueless because I am :)
>>Dim rs1=adodb.recordset

it should be
 dim rs as adodb.recordset
if you use vbscript

you need to declare as just

dim rs

ie

dim c1 as adodb.connection

set c1 = wscript.createobject("adodb.connection")
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial