I use the following code to connect to an Informix db:
Dim oDb
Dim oRecSet
Dim oDbError
Dim sDbConnString
Dim sSql
Dim DSN
sSql = "Select first 1000 nds_no from asn where actual_po_no is null"
' Connect to db
Set oDb = CreateObject("ADODB.connection")
If oDb.state = 1 Then
WScript.Echo "Object State: " & oDb.state
oDb.close
End If
' Set DB connection string
sDbConnString = "DRIVER=IBM INFORMIX ODBC DRIVER" & ";" & "UID=" & "XXXX" & ";" & _
"PWD=" & "XXXX" & ";" & "PRO=onsoctcp;" & "SRVR=" & "crme05_tcp" & ";" & _
"SERV=" & "crme05_tcp" & ";" & "HOST=dundev01;" & "DB=" & "fss"
WScript.Echo "sDbConnString: " & sDbConnString
oDb.open sDbConnString
If oDb.Errors.Count > 0 Then
For Each oDbError In oDb.Errors
'If oDbError.Number <> 0 Then
WScript.Echo "Native Error: " & oDbError.NativeError
WScript.Echo "Description: " & oDbError.Description & vbNewLine
WScript.Echo "SQLState: " & oDbError.SQLState & vbNewLine
WScript.Echo "Source: " & oDbError.Source & vbNewLine
'End If
Next
oDb.errors.Clear
End If
' Query the database
Set oRecSet = CreateObject("ADODB.RECORDSET")
oRecSet.open sSql,oDb,3,3
WScript.Echo "oRecSet.RecordCount: " & oRecSet.RecordCount
When run I'm getting returned the following error:
Description: [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr
The above code worked fine up until last friday (26/09), there hasnt been any changes applied either.
What we have been unable to establish though is why the connection details work if we view the db via Excel but not via the vbs script.
Any help would be greatly appreciated.
Regards
David