Sign in to follow this  
Followers 0
Rishav

Running .sql file using Adodb connection

5 posts in this topic

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 :)

Share this post


Link to post
Share on other sites



fileread. hmmm. neat idea. will check it out.

thanks.

Share this post


Link to post
Share on other sites

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.

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