Computing Staff
  • 0

How To Connect To Dbaccess In Ksh Shell

  • 0


I’m starting with ksh and I’m a bit lost.
I’m working on an ERP that runs on Oracle or Informix.
I often need to update these databases with a lot of sql scripts.

I wrote a small shell that concatenate these files into a single script that connects to the Oracle database that I determine, and then run the script.

Here the shell (which can be improved, I’m sure):

echo ‘User:’
read USER
echo ‘Pass:’
read PASS
read SID
LIST=`ls -1 *ora.sql`
for i in $LIST
echo $i
cat $LIST >oracle.sql

sqlplus $USER/$PASS@$SID @oracle.sql

I’d like to do the same thing to update my Informix database, but I do not know what commands to use to log in dbaccess and run the script.

If anyone can help me, it would be nice.

Thank you,

And sorry for my English.



1 Answer

  1. Informix works differently from oracle in that it doesn’t require a user and password as arguments to the informix sql interface – dbaccess or isql.
    The user must be added to the dbaccess and granted the correct permissions. If your SQL is contained in a file.sql, you can probably do this:

    dbaccess -e < file.sql

    But I choose to do it differently. I embed the sql within a Unix here document. Here is an example:…

    • 0