Sign in to follow this  
Followers 0
Nachiket

Error while Connecting to Oracle

3 posts in this topic

I have problems in connecting with oracle.

I am getting the following error plus error like Object is closed etc etc

"err.description is: Object closed

"err.windescription: error not specifed

"err.number is: 80020009

"err.lastdllerror is: 0

"err.scriptline is: 42

"err.source is: ADODB.Recordset

"err.helpfile is: c:\WINDOWS\Help\ADO270.CHM

"err.helpcontext is: 1240653

Share this post


Link to post
Share on other sites



I have problems in connecting with oracle.

I am getting the following error plus error like Object is closed etc etc

"err.description is: Object closed

"err.windescription: error not specifed

"err.number is: 80020009

"err.lastdllerror is: 0

"err.scriptline is: 42

"err.source is: ADODB.Recordset

"err.helpfile is: c:\WINDOWS\Help\ADO270.CHM

"err.helpcontext is: 1240653

From the error message it looks like you are trying to access an object, on line 42 of your script or one of the UDFs you are including, after you have closed it.

Personally I woulddo not use ADODB with Oracle databases. I find it easier to uses Oracles own COM solution OO4O. Any error messages tend to be a little bit more specific.

It


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

@all

I don't have any problems using ADO and Oracle.

#include <GUIConstants.au3>

Dim $oMyError

; Initializes COM handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$ado = ObjCreate( "ADODB.Connection" )    ; Create a COM ADODB Object  with the Beta version

With $ado
    ; 'Set data source - for OLEDB this is a tns alias, for ODBC it can be 'either a tns alias or a DSN.
    ; If "provider" is used this means that the ODBC connections is used via DSN. 
    ; if Driver is used = "Driver={Microsoft ODBC for Oracle};Server=TNSnames_ora;Uid=demo;Pwd=demo;" then this is a DSN Less connector
    ; More Info for Oracle MS KB Q193332
    .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='BAAN10.PLASTIFLEX.BE' ;User Id='oracle';Password='tiger';") 
    .Open
EndWith

$adors = ObjCreate( "ADODB.RecordSet" )    ; Create a Record Set to handles SQL Records

With $adors
        .ActiveConnection = $ado
        ;.CursorLocation = "adUseClient"
        ;.LockType = "adLockReadOnly" ; Set ODBC connection read only
        .Source = "select * from TableHere"
        .Open ; 
EndWith

While not $adors.EOF
    For $i = 0 To $adors.Fields.Count - 1
    ConsoleWrite( $adors.Fields( $i ).Value & @TAB )    ; Columns in the AutoIt console use Column Name or Index
    Next
    ConsoleWrite(@CR)
    $adors.MoveNext                                                ; Go to the next record
WEnd

; This is Sven P's custom error handler added by ptrex
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  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 & $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(1)  ; to check for after this function returns
Endfunc

You have to make sure your ODBC and TNS settings are working correct.

regards,

ptrex

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0