Question:
How can I connect to an INFOMIX database via scripts?
Solution:
To connect to an INFOMIX database via scripts, you can use the following methods:
DBConnection.Open DBConnStr
Where:
To run a query, use:
“UPDATE Table SET name = ‘Alex’ WHERE id = 10”
To view all the desired records, returned in Recordset (query) format, you can use the following script:
Recordset.Source = “Table”
Recordset.ActiveConnection = DbConnection
Recordset.CursorType = 1 ‘ adOpenKeyset
Recordset.LockType = 3 ‘ adLockOptimistic
Recordset.Open
From that moment on, you will be able to browse the table via MoveNext and MovePrev commands, as well as via a series of other commands supplied by ADO. You will also be able to use an SQL query to handle specific parts of the table via Source property.
This type of access must only be used in cases where no other solution is possible.
The connection in the example uses ActiveX ADO.
NOTE: For further details on connection strings, check The Connection Strings Reference.