Home » Infrastructure » Unix » Connecting to oracle database
Connecting to oracle database [message #303019] Wed, 27 February 2008 10:54 Go to next message
shree_z
Messages: 75
Registered: February 2008
Member
Hi all,

I have a plsql procedure which is to be called by a shell script.

In my shell script I am trying to connect to the oracle database

Quote:
$ sqlplus -s apps/apps@GAMDEV << EOF


but I am getting an error

Quote:
'<<' unmatched


Am i writing the correct syntax to connect to the database?

Please help!!

Thanks in advance
Re: Connecting to oracle database [message #303020 is a reply to message #303019] Wed, 27 February 2008 10:57 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Probably you missed the ending EOF.

scott@9i > Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.8.0 - Production
oracle@mutation#sqlplus -s scott/tiger <<EOF
> select sysdate from dual;
> exit;
> EOF

SYSDATE
---------
27-FEB-08

Re: Connecting to oracle database [message #303022 is a reply to message #303020] Wed, 27 February 2008 11:25 Go to previous messageGo to next message
shree_z
Messages: 75
Registered: February 2008
Member
Hi Mahesh,

Thanks for our help. Now the syntax error is gone.

Should I initialize with something else?

Now i am getting

Quote:
sqlplus: not found
Re: Connecting to oracle database [message #303023 is a reply to message #303022] Wed, 27 February 2008 11:28 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>Should I initialize with something else?
You tell me. It is your program. Smile
Atleast, you should export ORACLE_HOME, PATH=$PATH:$ORACLE_HOME/bin etc.
Re: Connecting to oracle database [message #303027 is a reply to message #303023] Wed, 27 February 2008 11:42 Go to previous messageGo to next message
shree_z
Messages: 75
Registered: February 2008
Member
Thanks a lot Mahesh,

Could you please give an example?
Re: Connecting to oracle database [message #303028 is a reply to message #303027] Wed, 27 February 2008 11:46 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
oracle@mutation#somescript

SYSDATE
---------
27-FEB-08

oracle@mutation#cat somescript
#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/9.2.0
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus -s scott/tiger <<EOF
select sysdate from dual;
exit;
done
Re: Connecting to oracle database [message #303034 is a reply to message #303028] Wed, 27 February 2008 12:34 Go to previous message
shree_z
Messages: 75
Registered: February 2008
Member
Thank you so much Mahesh,

I appreciate!!
Previous Topic: error in shell scripting (merged)
Next Topic: Accepting out parameters from a pl/sql procedure
Goto Forum:
  


Current Time: Thu Nov 21 23:26:43 CST 2024