How Connect to a Database in Shell Programming?

Answers were Sorted based on User's Feedback



How Connect to a Database in Shell Programming?..

Answer / ashu

you have a "sqlplus" command to connect to database.

command is as follows:

sqlplus <db_username>/<db_password> @test.sql

Is This Answer Correct ?    19 Yes 6 No

How Connect to a Database in Shell Programming?..

Answer / sibin kc

You can simply use as follows.

mysql -h <hostname> -u <user name> -p<password> -e "use
psa;select * from domains where domain_name = 'hai.com';"

Is This Answer Correct ?    9 Yes 6 No

How Connect to a Database in Shell Programming?..

Answer / seshadri sethi

(1)1st give "sqlplus"
(2)then it will show "sqlplus" prompt
(3)give "db username"
(4)give "db password"

Is This Answer Correct ?    8 Yes 6 No

How Connect to a Database in Shell Programming?..

Answer / supraja

mysql -uusername -ppassword -hipaddress database -e "statement"

eg:mysql -uroot -psuppu -h192.168.0.1 supraja -e "select
count(*) from table"

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Shell Script Interview Questions

In shell scripting if text is surrounded by single quotes what does it denotes?

3 Answers  


on “sed” command EmpData(Sample Database) 1122|j.b. saxena |g.m. |account |12/12/52|6000 2233|n.k. gupta |d.g.m |sales |31/12/40|9000 4545|anil agarwal |director |account |06/07/47|7500 5656|lalit choudhury |executive|marketing|07/09/50|5000 1265|chanchal singhvi|g.m. |admin |12/09/63|6000 0110|shyam saksena |chairman |marketing|12/12/43|8000 5566|jai sharma |director |account |23/12/89|7000 7733|jayant |d.g.m |sales |29/02/70|6000 1. From the above database substitute the delimiter of first 3 lines with “ : “ 2. From the above database substitute the delimiter with “ : ” 3. Insert the string “ XYZ Employees” in the first line. 4. Store the lines pertaining to the directors, d.g.m and g.m into three separate files. 5. Using address store first 4 lines into a file Empupdate. 6. Find the pattern “account” in the database and replaces that with “accounts”. 7. Select those lines which do not have a pattern “g.m”. 8. Insert a blank line after every line in the database.

0 Answers  


How to initialize a directory size to a variable??

2 Answers  


What are the additional egrep symbols?

2 Answers  


How to know that your remote server is ruing smoothly or not in unix?

1 Answers  






Explore about environment variables?

0 Answers  


RAM one table colums a1,a2,a3,a4 respective values 2,4,7,8 KRISH one table colums a1,a2,a3,a4 respective values 3,4,6,9 IN RAM & KRISH a4 column if comparing values RAM A4 - KRISH A4 ( 8-9 =1 THEN print 5 or (RAM) a4 value 10 KRISH a4 values 2 then 10 -2 =8 print 5*8=40 or diff 5 print same

1 Answers   Tech Mahindra,


How to get the 3rd element/column from each line from a file?

0 Answers  


Please anyone suggest atleast 2 good training institutes in Hyderabad, INDIA where i can learn unix shell scripting.

1 Answers  


Hi Friends, I am currently Undergoing Course On Testing.I am Planning To Keep Fake Resume.Can any One tell me the ways to Prepare i.e, Real Time experience For Manual Testing. With Regards, Vikram

1 Answers  


Explain about non-login shell files?

0 Answers  


c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command

0 Answers  


Categories