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:

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

Leave a Reply

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