Jump to content

Running .sql file using Adodb connection


 Share

Recommended Posts

Considering that adodb is my latest crush, here's my new roadblock.

Dim $OraOBJConn, $OraOBJRecSet


    ; Different queries depending on DB types
    If $Settings_Main_DBType_inp = "ORACLE" Then

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

        With $OraOBJConn
            .ConnectionString = ("Provider='OraOLEDB.Oracle';Data Source=" & $Settings_Main_TNS_inp & ";User Id='" & $Settings_Main_SysUserID_inp & "';Password='" & $Settings_Main_SysUserPass_inp & "';")
            .Open
        EndWith

        ; Create a Record Set to handles SQL Records
        $OraOBJRecSet = ObjCreate("ADODB.RecordSet")
        With $OraOBJRecSet
            .ActiveConnection = $OraOBJConn
            .Source = "Select something from something"
            .Open
        EndWith

        $OraOBJConn.Close
    EndIf

Now instead of running a simple select query, i want to invoke a sql file (i normally use it via a batch file containing the sqlcmd command. Any ideas folks?

thanks and regards

Rishav :)

Link to comment
Share on other sites

  • 6 months later...

Hi Everyone,

I'm a newbie with AutoIt and oracle, the code above is similar to what I am trying to achieve, so that is why I am replying to this.

I wanted to know how to send anonymous blocks to oracle?

For example, from the code above,

With $OraOBJRecSet

.ActiveConnection = $OraOBJConn

.Source = "select Destination from Destinations where dest_id = 0"

.Open

EndWith

This sections sends one query to the db and returns the result. How do I attach more queries to it?

I have tried concatenating queries, which doesn't work, I have tried using " ; " after my query ends, but I always get an ORA invalid character error, and I'm not really sure how to do this.

Any help would be greatly appreciated.

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...