Connection to database through shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Connection to database through shell script
# 1  
Old 01-08-2009
Connection to database through shell script

Hi

when i am calling the shell script with two parameter like id and date it works fine.But the same shell script is call by java application it gives the error as shown below
Code:
Thu Jan  8 04:13:22 EST 2009|The Get Segment Process Failed: SP2-0306:
Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] where <logon>  ::= <username>[/<password>][@<connect_identifier>] | /
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] where <logon>  ::= <username>[/<password>][@<connect_identifier>] | /
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] where <logon>  ::= <username>[/<password>][@<connect_identifier>] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

The code for calling the data base as given below
Code:
RUNID=$1
BUS_DT=$2
sleep 10
auth=`cat ..pass`
STD_LOGFILE=/temp/logs
DT=`date +%Y%m%d:%H%M%I`

returnedvalue=`sqlplus -s $auth <<EOF set 
serveroutput on 
WHENEVER SQLERROR EXIT 1 
exec mapping_runid_to_segment($1) 
set serveroutput OFF EXIT; 
EOF` 

the main problem is accepting userid/pass($auth) by parameter.If i hardcoded than also its working fine with java application any suggestions
# 2  
Old 01-08-2009
Please, be more specific about your questions.
I can see no JAVA here. Only shell (might be something else as shell...) script that seems to be calling sqlplus. By the way: you can call a script from the sqlplus using command line...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to fix connection to Oracle database through shell script?

I have a question regarding how to connect to Oracle Database through shell script. 1. If I want call a stored procedure on Linux server as this, it works. $sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 12 14:49:49 2015 Copyright (c) 1982, 2014, Oracle. All rights... (2 Replies)
Discussion started by: duke0001
2 Replies

2. Ubuntu

Database Connection

Hi, How to creating connection to mysql.I try to connect but the following error coming .How to solve it. Could not connect to New MySQL. Error creating SQL Model Connection connection to New MySQL. (Error: com.mysql.jdbc.Driver) com.mysql.jdbc.Driver Error creating JDBC Connection... (2 Replies)
Discussion started by: snallusami
2 Replies

3. Shell Programming and Scripting

Database connection from korn shell prompt

Hello, I want to connect to Database through shell command line. Here is my command from putty, $ sqlplus -S ora/ora@ORA But I am not able to connact to database. If this command succed, what is the expected output on shell prompt? Could you please let me know how to connact to... (3 Replies)
Discussion started by: Poonamol
3 Replies

4. Shell Programming and Scripting

SFTP connection using shell script

Hi , I am able to manually connect to remote system usning "sftp" protocol. But when I using the below command in the script but I am not able to connect. `sftp TEST01@120.34.3.4` And the connection should not be closed after login. Please help to solve this. Thanks Satya (2 Replies)
Discussion started by: Satyak
2 Replies

5. Shell Programming and Scripting

oracle connection from shell script

Hi, For connecting to oracle my script is using the command sqlplus username/password@db_instance_name.For this to work i am setting ORACLE_HOME,TNS_ADMIN and ORACLE_SID in a seperate script.My question is,could we make a connection to oracle just by the command sqlplus... (4 Replies)
Discussion started by: DILEEP410
4 Replies

6. Shell Programming and Scripting

Database Connection test in unix Script

i have a unix script that gives me the sysdate from the database EDNAMID.WORLD.What i want my script to do the following 1) Establish a database connection 2) if database connection is successfull then echo the message "Connected" 3) put the o/p of the Sql query in a spool file 4) then... (3 Replies)
Discussion started by: ali560045
3 Replies

7. UNIX for Dummies Questions & Answers

sybase connection through shell-script

:mad: how do i connect to sybase through shell script written in linux (9 Replies)
Discussion started by: Amitabh
9 Replies

8. Shell Programming and Scripting

Shell Script: want to insert values in database when update script runs

Hi , I am new to linux and also also to shell scripting. I have one shell script which unpacks .tgz file and install software on machine. When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Discussion started by: ring
1 Replies

9. Programming

database connection

i want to connect c++ to ms access. i am not clear about the concept of odbc please make me clear that for the above connection which version of odbc i will need? i am working on solaris so is there any kind like an odbc for windows and odbc for solaris? form where i can get the odbc... (0 Replies)
Discussion started by: ramneek
0 Replies

10. Programming

Database connection

Hi! I have very limited experience in UNIX, I have couple questions about database connection in C programs. I used to use pro*C to setup database connection to a remote Oracle server when I was in school about 2 yrs ago, is this method still in use in commercial C programs nowdays?... (2 Replies)
Discussion started by: whartoner
2 Replies
Login or Register to Ask a Question