can a shell script interact with database?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting can a shell script interact with database?
# 8  
Old 08-09-2007
Here is an example to access EMP_ID from EMP table:

##############################

qry_ChkEmpID=`sqlplus -s ${db_conn} <<!
set head off;
set feedback off;
select emp_id from EMP where
emp_name = 'SAM' ;
exit;
!`

export str_EMP=$(echo $qry_ChkEmpID)
echo "Emp Id : " $str_EMP


########################
# Emp ID is stored in the str_EMP variable , db_conn is the connection string.

--S
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect script - Interact help

Hi Guys, Further to my post yesterday I have got round the issue of not being able to use expect by using one of our unix machines to have the script running instead of the jumpbox itself. However my issue is I now have an extra bit it the script which is shh to the jumpbox which requires a ras... (1 Reply)
Discussion started by: mutley2202
1 Replies

2. Shell Programming and Scripting

can a nohup'ed ksh script interact with user

I have a long running ksh script that I need to run with "nohup" in the backgound which is all well and good but at the very start of the script it needes to output to the screen to query the user and accept a response before continuing. Any thoughts on how to accomplish this other than... (11 Replies)
Discussion started by: twk
11 Replies

3. Programming

How could I interact with shell script from webportal written in php?

Hello, I am new on PHP scripting .I have shell scripts which I an running currently from linux server but now I want to make a web portal from where I will run all my scripts but the problem is all my scripts ask for parameters so I am getting confused how could I run my shell script from web... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

4. Shell Programming and Scripting

Expect script exiting too fast if used without interact.

Hi I'm working on an Expect script that is supposed to log-into a remote server and run some steps and exit. In the script I first spawn a 'ssh' session to the server and then after logging in I 'send' all the necessary steps ( with a '\r' at the end, so that they get automatically executed the... (3 Replies)
Discussion started by: clakkad
3 Replies

5. Shell Programming and Scripting

Switch from one database to other using shell script

Hi all, This is my first ever post to any forum so, dont let this go in vain...........:) Here is the scenario........ I have logged into the unix where oracle_sid is initialized for some X database in the .profile. I have a unix script where some sql query which fetches data from X... (3 Replies)
Discussion started by: sachinkl
3 Replies

6. Programming

Need help on Shell script for database maintainace..

Hi All, I have to perform some tasks for database maintainace. I am using postgresql on RHEL 4.4. 1) I have to run "vacuumedb" on the database as postgres user. 2) I have to reindex the database as postgres user. Now i want to write shell script to do these tasks one... (3 Replies)
Discussion started by: ashokkumar.p
3 Replies

7. Shell Programming and Scripting

How to make shell script interact with program

Hello all! I have a C program that runs on a loop, prompting the user for input until it is exited. I want to create a shell script that can run this program and provide input. How can I do this? I have investigated 'expect' and piping to stdin, but haven't had any success. Any help is... (2 Replies)
Discussion started by: radish04
2 Replies

8. Shell Programming and Scripting

get result from database into shell script

hi, I have a script that will logon to a database siebel and do the select query and then get the result in command prompt of unix.Below the script. #!/bin/ksh . $HOME/conf/systemProperties/EnvSetup.properties #set -x while read i do echo $i connect1=`sqlplus -silent... (1 Reply)
Discussion started by: ali560045
1 Replies

9. Shell Programming and Scripting

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 Thu Jan 8 04:13:22 EST 2009|The Get Segment Process Failed: SP2-0306: Invalid option. Usage: CONN where <logon>... (1 Reply)
Discussion started by: ravi214u
1 Replies

10. 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
Login or Register to Ask a Question
XtAppGetErrorDatabase(3)					   XT FUNCTIONS 					  XtAppGetErrorDatabase(3)

NAME
XtAppGetErrorDatabase, XtAppGetErrorDatabaseText - obtain error database SYNTAX
XrmDatabase *XtAppGetErrorDatabase(XtAppContext app_context); void XtAppGetErrorDatabaseText(XtAppContext app_context, char *name, char *type, char *class, char *default, char *buffer_return, int nbytes, XrmDatabase database); ARGUMENTS
app_context Specifies the application context. buffer_return Specifies the buffer into which the error message is to be returned. class Specifies the resource class of the error message. database Specifies the name of the alternative database that is to be used or NULL if the application's database is to be used. default Specifies the default message to use. name type Specifies the name and type that are concatenated to form the resource name of the error message. nbytes Specifies the size of the buffer in bytes. DESCRIPTION
The XtAppGetErrorDatabase function returns the address of the error database. The Intrinsics do a lazy binding of the error database and do not merge in the database file until the first call to XtAppGetErrorDatbaseText. The XtAppGetErrorDatabaseText returns the appropriate message from the error database or returns the specified default message if one is not found in the error database. SEE ALSO
XtAppError(3), XtAppErrorMsg(3) X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.1.3 XtAppGetErrorDatabase(3)