anyone please suggest me tutorial for database connectivity in unix shell scripts?
i think we can use the same commands we run in the shell prompt. is it?
anyone please suggest me tutorial for database connectivity in unix shell scripts?
i think we can use the same commands we run in the shell prompt. is it?
Thanks Barbie for asking this query.
I too wanted to get to know about this.
Hi shal raji,
i learnt about it.
there is no special syntax to do this.
just connect to database using "sqlplus" as u will do in shell prompt and go on with ur sql queries. thats it.
but i don know any link to learn about this. if i get to know any link, i will it post here.
there is no special command for data base connectivity
i use informix database with unix
i write all informix command in a shell
and if executed with authentication to data base the result is same
i am able to mix normal scripting command with database command
i enables me do write database related cron very easily
isql -s$servername -u$username -p$password this is the syntax i think...
ls –l|grep –v ‘..\.’ what is themeaning of this command
This expression filters out all the files listed out by the commands 'ls -l' and the removes the files having names containing the DOT (.) character.
grep is for pattern matching. grep with '-v' takes out only those which don't match that pattern. In the pattern. '\.' refers to the dot character. The other dots refer to any one or more occurance of the said character.
Pl note that apparently it may lists out the directoies (because directory names have no dot usually), but it is not. You get the same result for '.\.' also.
Hope you have got the answer.
Just write a shell script:- sample posted below
result=`sqlplus -s har/har <<eof!
set feedback off
set heading off
set verify off
select count(*) from table.abc@cinder;
commit;
exit
eof!`
isql
An interactive command-line shell that allows executing SQL statements
isql -S<server> -U<user id> -P<password> -c -w 20000000000 use <dbname>
Example:
isql –SNYP_LASER1 -Umacigrab -Pmacigrab -c -w 20000000000 use dbloan
1> SELECT COUNT(*) FROM agreements
2>
-----------
363
(1 row affected)
1> SELECT MAX(agreement_id) FROM agreements
2>
-----------
365
(1 row affected)
1> exit
isql
An interactive command-line shell that allows executing SQL statements
isql -S<server> -U<user id> -P<password> -c -w 20000000000 use <dbname>
Example:
isql –SNYP_LASER1 -Umacigrab -Pmacigrab -c -w 20000000000 use dbloan
1> SELECT COUNT(*) FROM agreements
2>
-----------
363
(1 row affected)
1> SELECT MAX(agreement_id) FROM agreements
2>
-----------
365
(1 row affected)
1> exit
See if this works...since it has worked for me but again it quite customized utility provided.....
i cannot understand the following shellscript,i will be thankfull if tell me the answer.
write a shell script that receive a login name interactively and display the details of the users on the display screen in an easily understandamle format
well u can try this
I guess it should work.
==========================================
echo "Enter username : "
read uname
echo "The username entered is $uname"
echo `finger $uname`
==========================================
Let me know if it works.