VBScript Informix DSN Test Script

So I have an Informix Dynamic Server (7) and I want to setup a Microsoft Windows ODBC system profile and then connect to it using VBScript.

I will go the easy route and install IConnect 2.90 Informix Driver for Windows.

After installing the driver, I will configure the ODBC connection:

Informix ODBC System Configuration

 

After this is configured, I “Apply & Test Connection” and it is successful.

Next, I found a piece of VBScript to facilitate a quick check using the my ODBC connection profile;  I named this “TIGER_v001″ for the DSN by the way.

Here’s the VBScript.

Dim objConnection,objRecordset,strSearchCriteria
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")

objConnection.Open "TIGER_v001"

Wscript.echo "Connected"

objRecordset.Open "select * from foo" , objConnection, adOpenStatic, adLockOptimistic

If objRecordset.EOF Then
    Wscript.Echo "Record cannot be found."
Else
    Wscript.Echo "Record found."
Wscript.echo "id -:- "&objRecordset("id")

End If

objRecordset.Close
objConnection.Close

If all goes well, the output I receive is “1″ since I only have one id in the table ‘foo’.

This entry was posted in Windows and tagged , , by Rich Kreider. Bookmark the permalink.

About Rich Kreider

Rich, founder of Techish.net, is an IT guy with over 8 years professional experience in systems and network administration, design and development. He is currently employed with Creative Technology in Western Pennsylvania for the past 4 years. He has been working with computer technology for over 15 years amd is currently studying for is VCP5 certification.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>