Jewtus Posted August 26, 2014 Share Posted August 26, 2014 (edited) I am trying to connect to a database but I use an ODBC connection on my machine that I'm trying to eliminate the dependence on (I'm using the IBM DB2 connector which is not free... I had a trial version). This code works, but only if I have the ODBC connector setup in the windows settings: $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Mode = 16 ; shared $sqlCon.CursorLocation = 3 ; client side cursor $sqlCon.Open ("DSN="&$DSN&";UID="&$USERNAME&";Password="&$PASS&";DBALIAS="&$alias) If @error Then MsgBox(0, "ERROR", "Failed to connect to the database") Exit EndIf Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(0) ; to check for after this function returns Endfunc But I want to connect without needing to install any software on the machine (so there is no localized configurations needed). Does anyone know of a way to get around this? Maybe with a DLL file that I can call directly and include with the script? Edited August 26, 2014 by Jewtus Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now