Jump to content

Recommended Posts

Posted

Hi everybody,

I would like to connect to an informix db. I've installed an informix odbc connect driver and configured a dsn entry, but I don't know how to connect to this db. I've read that this is possible with connection strings, but is there not an easier way using the dsn entry ?

Thanks !

Posted (edited)

@rippa

Something like this :

; Informix

$objConn = ObjCreate("ADODB.Connection")

$objConn.Open ("Dsn=myDsn;" & _
           "Host=myHostname;" & _
           "Server=myServerName;" & _
           "Service=myServiceName;" & _
           "Protocol=onsoctcp;" & _
           "Database=myDbName;" & _
           "Uid=myUsername;" & _
           "Pwd=myPassword")

$rsCustomers = $objConn.Execute("SELECT * FROM Customers")
With $rsCustomers
    While Not .EOF
        ConsoleWrite(.Fields("CustomerID").Value & " - " & .Fields("CompanyName").Value & @LF)
        .MoveNext
    WEnd
    .Close
EndWith

$objConn.Close

regards

ptrex

Edited by ptrex
  • 11 years later...
Posted

Has anybody ever managed to connect to a Informix database with AutoIt?

I configured a User-DSN with the ODBC Data Source admin tool and tried following code:

$objConn = ObjCreate("ADODB.Connection")

$objConn.Open("Dsn=Informixtest;" & _
    "Host=myHost;" & _
    "Server=myServer;" & _
    "Service=myService;" & _
    "Protocol=onsoctcp;" & _
    "Database=myDatabase;" & _
    "Uid=myUsername;" & _
    "Pwd=myPassword")

$objConn.Close

But SciTE shows following error:

informixtest.au3" (3) : ==> The requested action with this object has failed.:
$objConn.Open("Dsn=Informixtest;" & "Host=myHost;" & "Server=myServer;" & "Service=myService;" & "Protocol=onsoctcp;" & "Database=myDatabase;" & "Uid=myUsername;" & "Pwd=myPassword")
$objConn^ ERROR

Posted (edited)

try my ADO.au3 UDF  

edit:

and do not forget to use COM ErrorHandler

Here is example:

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I think you have problem with connection string.

Did you read this examples:
https://www.connectionstrings.com/informix/

?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...