Re: Oracle Interaction From Shell

From: William Park (opengeometry_at_yahoo.ca)
Date: 04/22/05


Date: Fri, 22 Apr 2005 17:57:54 -0400

Chris <ctaliercio@yahoo.com> wrote:
> Does anyone know of a method, other than a sqlplus "here" document,
> that can be used to interact with Oracle from a UNIX shell?
>
> What I'd like to do is establish a connection and use it throughout the
> execution of a shell script in order to query and update the database.
>
> Using "here" documents to sqlplus can be quite expensive if the
> functions are executed often.
>
> I've considered using a co-process, but it seems that parsing the
> results to find out whether the command succeeded or not would be quite
> cumbersome.
>
> I also know that I could use Pro*C, but a lot of what I am doing in the
> shell script is somewhat of a PITA to incorporate within a C program.
> Much easier/simpler to use shell.
>
> Any thoughts from the group?

I can't help you w.r.t. Oracle. But, you may be able to borrow few
things from
    http://home.eol.ca/~parkw/index.html#sqlite
    http://home.eol.ca/~parkw/index.html#postgresql
    http://home.eol.ca/~parkw/index.html#mysql

Essentially, you build SQL strings, send it to database, and get the
results back (if any) in shell array variable. You can do the same
thing using client programs (ie. sqlite, mysql, psql), but you would
need to re-parse the result, which tends to be pain.

I've been meaning to add Oracle interface, but I couldn't find the
source for Oracle, and more importantly API documentations.

-- 
William Park <opengeometry@yahoo.ca>, Toronto, Canada
Slackware Linux -- because it works.


Relevant Pages

  • query data from external shell ?
    ... when activating the shell it calls a *.sql that queries the data from ... a oracle databe tableinto a spool file and saves it in the therefore ... Is this possible to do on access by a external script or scripts run by a ...
    (microsoft.public.access.conversion)
  • query data from acces tables from shell
    ... when activating the shell it calls a *.sql that queries the data from ... a oracle databe tableinto a spool file and saves it in the therefore ... Is this possible to do on access by a external script or scripts run by a ...
    (microsoft.public.access.externaldata)
  • Re: Connection problem through sqlplus
    ... I have 2 instances of oracle installed on my solaris box. ... I hardly use the 10g and have 4 databases configured on 9i. ... I have written some shell scripts to connect to the ... it sources the /usr/local/bin/coraenv script. ...
    (comp.databases.oracle.server)
  • Re: databases from unix shell
    ... > database from unix shell programming. ... For database access from Shell, try using Perl with modules such as ... For C and C++ database interfacing, ... For example, Oracle database can be ...
    (comp.unix.shell)
  • Re: query data from external shell ?
    ... write an Append query to move the data from Access to MySQL. ... (You may be able to do it directly from Oracle to MySQL using Access as the ... and write queries directly from one to the other. ... > when activating the shell it calls a *.sql that queries the data ...
    (microsoft.public.access.conversion)