GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Operating System  >  Shell Scripting
Go To First  |  Previous Question  |  Next Question 
 Shell Scripting  |  Question 45 of 47    Print  
Database Connecion
How will you write a shell script to connect to SQL database?


  
Total Answers and Comments: 2 Last Update: June 19, 2009     Asked by: pranoy 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 27, 2009 12:32:36   #1  
bhaileem Member Since: May 2009   Contribution: 2    

RE: Database Connecion
sqlplus $DBA_userid '/'$DBA_passwd@oracle_sid .
 
Is this answer useful? Yes | No
June 17, 2009 05:00:08   #2  
wow_suraj Member Since: May 2008   Contribution: 22    

RE: Database Connecion

1> #!/bin/ksh

2>

3> sqlplus /nolog < /dev/null

4>

5> connect USER/PASSWORD@DATABASENAME

6>

7> WHENEVER SQLERROR EXIT 5

8> WHENEVER OSERROR EXIT 10

9>

10> @ONE.sql

11>

----------------------------------------------

given snippet will connect to the database--line # 3 n 5

and sql script (ONE.sql) will be executed-- line #10


However other methods are also there to connect to the database

----------------------------------------------

sqlplus -s USER/PASSWORD@DATABASE << ENDSQL


sqlplus -S USER/PASSWORD@DATABASE <<-! 2>&1

----------------------------------------------


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : IF the Database is DB2 then the script is :db2 "connect to $dbname user $userid using $password" ...
Read Answers (7) | Asked by : Brahma Reddy Thatiparthi

How will you write a shell script to connect to SQL database? 
Latest Answer : 1> #!/bin/ksh 2> 3> sqlplus /nolog < /dev/null 4> 5> connect USER/PASSWORD@DATABASENAME 6> 7> WHENEVER SQLERROR EXIT 5 8> WHENEVER OSERROR EXIT 10 9> 10> @ONE.sql 11> ---------------------------------------------- given ...
Read Answers (2) | Asked by : pranoy


 Sponsored Links

 
Related Articles

Using XMLType for Handling XML Data in the Database

Using XMLType for Handling XML Data in the Database Being an object type XMLType can not only be used to store XML data in the database but also to operate on that data via its built in methods Regardless of the storage model you choose XMLType provides a set of XML specific methods to operate on XM
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

Performing XSLT Transformations inside the Database

Performing XSLT Transformations inside the Database Now that you have the employees XSL stylesheet stored in the database and the xmlusr schema is permitted to access the hr employees table you can create a script that will instruct the database to build an HTML page based on the data stored in hr e
 

Moving All the XML Processing into the Database

Moving All the XML Processing into the Database In the preceding example the database server performs only a part of the XML processing while the rest is still performed by the PHP engine Specifically the database server generates an employees XML document based on the records from the hr employees
 

Performing XML Processing inside the Database

Performing XML Processing inside the Database When building XML enabled applications on top of Oracle there are many advantages to performing the XML processing inside the database when compared to performing it on the client The key advantages to perform XML processing inside the database are as fo
 

What is Operational Database

Operational Database is the database-of-record, consisting of system-specific reference data and event data belonging to a transaction-update system. It may also contain system control data such as indicators, flags, and counters. The operational database is the source of data for the data warehouse
 

Evolution of database systems

The Evolution of Database systems File Management System Hierarchical database System&nbsp; Network Database System&nbsp; Relational Database System File Management System: The file management system also called as FMS in short is one in which all data is stored on a singl
 

How to call C header that is not provided generally by system in C++?

Headers can be called by using extern C Syntax of extern C is: extern &quot;C&quot; &lt;function declaration&gt; for example to call C functions from C++ we can write extern &quot;C&quot; { &lt;function declaration&gt; &lt;function declaration&gt; ...
 

Database Concurrency and Reliability

Database Concurrency and Reliability Overview Concurrency and reliability have long been &ldquo;hot topics&rdquo; of discussion among developers and users of distributed systems. The fundamental problem can be seen in a simple example, as follows. Suppose two users are working on the same
 

Database Interaction

Database Interaction Efficient interaction, efficient storage, and efficient processing are the three key properties of a successful database platform. In this article, we explore the first: efficient interaction. Interaction Category 1: Command Line Clients Many database platforms are shipped with
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape