Computing Staff
  • 0

How To Connect To Dbaccess In Ksh Shell

  • 0

Hi,

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
echo ‘DATABASE SID:’
read SID
LIST=`ls -1 *ora.sql`
for i in $LIST
do
echo $i
cat $LIST >oracle.sql
done

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

And sorry for my English.

 

Share

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:

    # UNTESTED
    dbaccess -e < file.sql

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

    http://www.computing.net/answers/un…

    • 0