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?
fylix0000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

g_johnsonCommented:
dim c1 as adodb.connection
dim rs1 = adodb.recordset

set c1 = new adodb.connection
c1.connectionstring = "ODBC=ODBC_SQL"
c1.open

set rs1 = new adodb.recordset
set rs1.activeconnnection = c1

on error goto errTrap:
rs1.open "SELECT 'Y' FROM table_name"
'no problem with table or connection
rs1.close

ExitHere:
   set rs1.activeconnection = nothing
   set rs1 = nothing

   c1.close
   set c1 = nothing

ErrTrap:
    'problem with table or connection


does that help?

0
fylix0000Author Commented:
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 :)
0
hiteshgupta1Commented:
>>Dim rs1=adodb.recordset

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

you need to declare as just

dim rs

ie

dim c1 as adodb.connection

set c1 = wscript.createobject("adodb.connection")
0
EDDYKTCommented:
dim c1
set c1 = wscript.createobject("adodb.connection")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.