Jump to content

Connect oracle?


macost
 Share

Recommended Posts

Does Oracle have COM functions? Command-line?

These are things you have to check. I am sure there is a way that AutoIt can interact with Oracle, but I haven't seen any UDF's for that yet.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I can connect AutoIt with Oracle???

how I can make? has some example?

Tks

You can use the MySQL UDF. http://www.autoitscript.com/forum/index.php?showtopic=20814. It uses ODBC to connect to MySQL and thus should work with Oracle as well, provided that you have a proper ODBC driver for Oracle and don't need some special Oracle features. Some changes of the mySQL UDFs might be necessary.

Also search the forum for "+objcreate +ADODB". You will find some other samples for ODBC.

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

@macost

#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='TNS NAME HERE';User Id='XXXX';Password='XXXXX';") 
    .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 TABLE NAME HERE"
        .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 COM error Handler
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

Change your TNS name, User and Password as well as your select statement.

Enjoy

ptrex

Link to comment
Share on other sites

  • 3 months later...

I am with problems in conexao with oracle.

"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

and

"err.description is: error not specifed

"err.windescription: error not specifed

"err.number is: 80020009

"err.lastdllerror is: 0

"err.scriptline is: 38

"err.source is: Provider

"err.helpfile is:

"err.helpcontext is: 1240640

How to solve?

I need help!!!!!!

Tks

Link to comment
Share on other sites

  • 2 months later...

I have sucessfully connected to Oracle! Thank you ptrex!

Macost, você provavelmente esqueceu de substituir os campos informados ou o nome da tabela (que ele não informou para substituir). Já conseguiu esta conexão?

Best regrds,

Edward Firmo

Link to comment
Share on other sites

  • 3 years later...
  • 1 year later...

5 years later, and I found this post to be helpful. I got my connection working today, and am quite happy about getting data back!

One thing to note, is that after much trial and error, I am using "Provider" but it is working with a TNS Name, not a DSN. Just thought it would be worth a response so that any others that are looking for help on this topic maybe will save a bit of time.

Cheers!

Link to comment
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
 Share

  • Recently Browsing   0 members

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