CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS J2EE JDBC DETAILS
Question :
What are the steps for connecting to the database using JDBC
Category JDBC Interview Questions
Rating (0.0) By 0 users
Added on 7/14/2006
Views 1251
Rate it!
Answers:

Here are the steps.

Using Driver Manager:
1. Load the driver class using class.forName(driverclass) and class.forName() loads the driver class and passes the control to DriverManager class
2.DriverManager.getConnection() creates the connection to the databse

Using DataSource.
DataSource is used instead of DriverManager in Distributed Environment with the help of JNDI.
1. Use JNDI to lookup the DataSource from Naming service server.
2. DataSource.getConnection method will return Connection object to the database



String url="sun.jdbc.odbc.JdbcOdbcDriver"
Connection con=DriverManager.getConnection(url,"username","password");



 Posted by: vani.p    

Contact vani.p  Contact vani.p


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
While in CallableStatament using in the oracle my procedure is return no.of columns so in java
View Answer
How to call a Stored Procedure from JDBC?
View Answer
What Class.forName will do while loading drivers?
View Answer
What packages are used by JDBC?
View Answer
What are the common tasks of JDBC?
View Answer
What Class.forName( ) method will do?
View Answer
How to get the resultset of stroedProcedure
View Answer
How can store images in a data base?
View Answer
Why do we use prepared statement when already statement is present
View Answer
Which is the best driver among the 4 jdbc drivers?how can we load that driver?

View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL JDBC Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/5013/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.66