VBScript Informix DSN Test Script

Your ads will be inserted here by

Easy AdSense Lite.

Please go to the plugin admin page to paste your ad code.

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’.

About Rich Kreider

Hello, world! I'm over 1/4 of a century old. I'm just another tech guy swinging from vine to vine in the jungle of technology and life. I currently work for an IT consulting firm in northwestern Pennsylvania and before that I was a system administrator for a small ISP that was centrally located in Ohio's Amish area. The answer is 42.
This entry was posted in Windows and tagged , , . Bookmark the permalink.

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>