Gulae Posted November 6, 2009 Share Posted November 6, 2009 Hi all, first steps of requesting some data through sql from an iSeries DB2 table, using the following code, connection with table seems to work, but when I want to retreive the data I get an error: coding: $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.ConnectionString = "File Name=F:\UDL\B32903.UDL;" $sqlCon.Open ; state connection 0 = N-OK ; 1 = Ok ; 2 = Connecting $status = $sqlCon.State MsgBox ( 0, "status", $status) ; request data $strSQL = "Select * from GLAENEN/INSZ1; " $result = $sqlCon.execute ($strSQL) $sqlCon.Close when running in scite it gives the following error: >"F:\AUTOIT\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:\AUTOIT\testenvironment\sql.au3" /autoit3dir "F:\AUTOIT\AutoIt3" /UserParams +>15:22:55 Starting AutoIt3Wrapper v.1.8.3 >Running AU3Check (1.54.9.0) from:F:\AUTOIT\AutoIt3 +>15:22:55 AU3Check ended.rc:0 >Running:(3.2.8.1):F:\AUTOIT\AutoIt3\autoit3.exe "F:\AUTOIT\testenvironment\sql.au3" F:\AUTOIT\testenvironment\sql.au3 (25) : ==> The requested action with this object has failed.: $result = $sqlCon.execute ($strSQL) $result = $sqlCon.execute ($strSQL)^ ERROR ->15:22:58 AutoIT3.exe ended.rc:1 +>15:22:59 AutoIt3Wrapper Finished >Exit code: 1 Time: 4.253 anyone has any idea? Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 6, 2009 Share Posted November 6, 2009 Add a COM error handler so you can get the description of the error. Is "GLAENEN/INSZ1" a valid table specification? Does DB2 require a ";" at the end of a query? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Zedna Posted November 6, 2009 Share Posted November 6, 2009 (edited) I'm not sure if GLAENEN/INSZ1 is valid table name especially /Try to select data from another table without special characters in its table name.EDIT: Also try to retrieve data by recordset using $oRS = ObjCreate ("ADODB.Recordset")Search forum for more examples ... Edited November 6, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Gulae Posted November 9, 2009 Author Share Posted November 9, 2009 Thanks for the input guys, just giving the next steps I executed that gave me the solution, maybe this can help someone who encounters the same problem. 1. I added an error handler that game me the extra information about the error. 2. I search this error upon the iseries environment which defined that the naming convention was wrong 3. Allthough within iseries I had to use GLAENEN/INSZ1 I replaced the / by a . which seemed the work. As a final step I'll give the new correct code: expandcollapse popupGlobal $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.ConnectionString = "File Name=F:\UDL\B32903.UDL;" $sqlCon.Open ; state connection 0 = N-OK ; 1 = Ok ; 2 = Connecting $status = $sqlCon.State MsgBox ( 0, "status", $status) ; request data $strSQL = "Select F2 from glaenen.insz1" $result = $sqlCon.execute ($strSQL) $sqlCon.Close ; This is my custom defined error handler Func MyErrFunc() Msgbox(0,"AutoItCOM 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 & hex($oMyError.number,8) & @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 _ ) Local $err = $oMyError.number If $err = 0 Then $err = -1 $g_eventerror = $err ; to check for after this function returns Endfunc thx again, a happy user ;-) 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