Title: Command Line Sql On Aix
cd_dotdot - January 20, 2006 01:26 AM (GMT)
Is there a way I can do SQL calls from the command prompt in AIX while logged into LID? Please give clear instructions if it is possible.
Thanks
cd_dotdot
back that thang up :rau:
schroncd - January 20, 2006 04:49 AM (GMT)
If you are using Oracle you can just execute 'sqlplus' from the LID commandline, which will drop you into Oracle SQL interface. I won't attempt to give you instructions as there are too many possible permutations for what you can do from the SQL prompt.
All the other supports RDBMSs have their own SQL interfaces. You should check your RDBMS documentation for complete instructions.
3monkeys - January 20, 2006 06:42 PM (GMT)
You can do it as long as you have the right environment variables set on your session. You didn't mention Oracle or SQL Server. I'm Oracle so here is what I do if I want to initiate a sqlplus session from the AIX command line in LID:
Go read your "capital Oracle" file. It's in $LAWDIR/yourproductlinename. This file contains the environment variables you need to use. It's easier than typing out the path and SID manually. It also contains the username/password for the lawson user so be careful who sees this file. Type in the following 5 lines at the command line:
. $LAWDIR/prod/ORACLE
(By putting the dot and a space in front of the command you're "reading" it, or at least that's what I like to think it's doing. I just know it works. Maybe somebody else can explain exactly what that means.)
export ORACLE_SID
export ORACLE_HOME
export PATH=$ORACLE_HOME/bin:$PATH
sqlplus
Then enter the username/password to get a SQL> prompt.
cd_dotdot - January 20, 2006 08:01 PM (GMT)
We actually have DB2 but I can't find the executable equivelant of sqlplus. For now I think I'll stick to my WinSql, but it would be nice to have this for when your hands are tied. By the way the WinSql tool is pretty great and its mostly free (some paid features you can do without.) do a google search and you'll find it.
cd_dotdot :thumb:
satterw - July 12, 2006 02:49 PM (GMT)
A little late on the reply, but the db2 command line program is just called "db2". If the db owner is db2inst1 (by default), on AIX it is probably located in /home/db2inst1/sqllib/bin/db2. You may have to run
. /home/db2inst1/sqllib/db2profile
first to get the variables set correctly.