Run Oracle Script from VB ODBC


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Run Oracle Script from VB ODBC

Hybrid View

  1. #1
    Karey Guest

    Run Oracle Script from VB ODBC


    Is it possible to run an Oracle script from VB 6? I am working through an
    ODBC and need to run a scripts to create a number of tables for a user.
    The syntax I am using is :

    connection.Execute "@c:\scriptname"

    I receive and "Invalid SQL Command" error when it is run, but the command
    works when pasted in SQLPlus....

    All suggestions appreciated!

  2. #2
    Brian Camire Guest

    Re: Run Oracle Script from VB ODBC

    Try reading the entire contents of your script file into a string and then
    passing the string to the Execute method of the Connection object.

    "Karey" <kkyle@catch4.com> wrote in message news:3c73cb7b$1@10.1.10.29...
    >
    > Is it possible to run an Oracle script from VB 6? I am working through an
    > ODBC and need to run a scripts to create a number of tables for a user.
    > The syntax I am using is :
    >
    > connection.Execute "@c:\scriptname"
    >
    > I receive and "Invalid SQL Command" error when it is run, but the command
    > works when pasted in SQLPlus....
    >
    > All suggestions appreciated!




  3. #3
    Karey Guest

    Re: Run Oracle Script from VB ODBC


    Yeah, I thought of doing that but the string is over 250 lines long, so I
    was hoping to avoid that ! Thanks a lot!

  4. #4
    hylton Guest

    Re: Run Oracle Script from VB ODBC


    There are API calls to shell to a windows command line and wait for whatever
    command is executed to finish...a standard shell command won't wait, but
    the API call will...basically, you just shell to SQLPlus w/ the file name
    as a command line parameter...if you don't need your process to wait for
    it to finish, you can use a regular shell VB command/statement.

    The downside of this is that you can't determine success or failure, unless
    you are writing that to a log file or table in your script...which is how
    we handle it...

    I don't have an example here at home of the API w/ wait functionality...I'll
    try to remember and post what I use at work tomorrow...doing the exact same
    thing from an app there...

    Chris

    "Karey" <kkyle@catch4.com> wrote:
    >
    >Is it possible to run an Oracle script from VB 6? I am working through

    an
    >ODBC and need to run a scripts to create a number of tables for a user.


    >The syntax I am using is :
    >
    >connection.Execute "@c:\scriptname"
    >
    >I receive and "Invalid SQL Command" error when it is run, but the command
    >works when pasted in SQLPlus....
    >
    >All suggestions appreciated!



  5. #5
    Ilamurugu.S Guest

    Re: Run Oracle Script from VB ODBC


    Hai,
    Have u got the solution for the Oracle trigger Execution thru Vb Coding
    . Can u Pleae Send me the Details.


    With Regards,
    Ilamurgu.S



    "Karey" <kkyle@catch4.com> wrote:
    >
    >Yeah, I thought of doing that but the string is over 250 lines long, so

    I
    >was hoping to avoid that ! Thanks a lot!



  6. #6
    Ilamurugu.S Guest

    Re: Run Oracle Script from VB ODBC


    Hai,
    Can u Please send me the API function for Trigger Execution thru VB.
    If it is possible please send me with examples.

    With Regards,
    Ilamurugu.S



    >
    >There are API calls to shell to a windows command line and wait for whatever
    >command is executed to finish...a standard shell command won't wait, but
    >the API call will...basically, you just shell to SQLPlus w/ the file name
    >as a command line parameter...if you don't need your process to wait for
    >it to finish, you can use a regular shell VB command/statement.
    >
    >The downside of this is that you can't determine success or failure, unless
    >you are writing that to a log file or table in your script...which is how
    >we handle it...
    >
    >I don't have an example here at home of the API w/ wait functionality...I'll
    >try to remember and post what I use at work tomorrow...doing the exact same
    >thing from an app there...
    >
    >Chris
    >
    >"Karey" <kkyle@catch4.com> wrote:
    >>
    >>Is it possible to run an Oracle script from VB 6? I am working through

    >an
    >>ODBC and need to run a scripts to create a number of tables for a user.

    >
    >>The syntax I am using is :
    >>
    >>connection.Execute "@c:\scriptname"
    >>
    >>I receive and "Invalid SQL Command" error when it is run, but the command
    >>works when pasted in SQLPlus....
    >>
    >>All suggestions appreciated!

    >



  7. #7
    hylton Guest

    Re: Run Oracle Script from VB ODBC


    The code being used to execute a BATCH file, Windows command line statement,
    etc from VB and wait on it to return is simply an API call to the WaitForSingleObject
    API...see the MS knowledgebase article at...

    http://support.microsoft.com/support.../Q129/7/96.ASP

    Basically, all I do is use this API to execute a sqlplus commandline statement...or
    a batch file w/ multiple sqlplus commandline statements...whatever...doesn't
    matter...it shells to the commandline, runs it, waits, and comes back when
    it's done...VB waits for it...

    Should work perfectly for you...

    Chris

    "Ilamurugu.S" <murugu@sierratec.com> wrote:
    >
    >Hai,
    > Can u Please send me the API function for Trigger Execution thru VB.
    >If it is possible please send me with examples.
    >
    >With Regards,
    >Ilamurugu.S
    >
    >
    >
    >>
    >>There are API calls to shell to a windows command line and wait for whatever
    >>command is executed to finish...a standard shell command won't wait, but
    >>the API call will...basically, you just shell to SQLPlus w/ the file name
    >>as a command line parameter...if you don't need your process to wait for
    >>it to finish, you can use a regular shell VB command/statement.
    >>
    >>The downside of this is that you can't determine success or failure, unless
    >>you are writing that to a log file or table in your script...which is how
    >>we handle it...
    >>
    >>I don't have an example here at home of the API w/ wait functionality...I'll
    >>try to remember and post what I use at work tomorrow...doing the exact

    same
    >>thing from an app there...
    >>
    >>Chris
    >>
    >>"Karey" <kkyle@catch4.com> wrote:
    >>>
    >>>Is it possible to run an Oracle script from VB 6? I am working through

    >>an
    >>>ODBC and need to run a scripts to create a number of tables for a user.

    >>
    >>>The syntax I am using is :
    >>>
    >>>connection.Execute "@c:\scriptname"
    >>>
    >>>I receive and "Invalid SQL Command" error when it is run, but the command
    >>>works when pasted in SQLPlus....
    >>>
    >>>All suggestions appreciated!

    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center