GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  JDBC
Go To First  |  Previous Question  |  Next Question 
 JDBC  |  Question 7 of 135    Print  
What are the steps for connecting to the database using JDBC

Answered by Jey on 2005-05-10 06:01:10: Here are the steps. 
 
Using DriverManager: 
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



  
Total Answers and Comments: 5 Last Update: October 18, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 10, 2005 06:01:10   #1  
Jey        

RE: What are the steps for connecting to the database using JDBC
Here are the steps. 
 
Using DriverManager: 
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

 
Is this answer useful? Yes | No
July 27, 2005 12:39:11   #2  
mahesh        

RE: What are the steps for connecting to the database using JDBC
What tw xml files inservlets?
 
Is this answer useful? Yes | No
August 01, 2005 05:15:20   #3  
Subramanyam        

RE: What are the steps for connecting to the database using JDBC
Using DriverManager:  
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  
Using Driver Object 
by creating driver object as 
Driver d=(Driver)Class.forName(Driver class).newInstance(). 
and we can now get connection using connect() method as 
Connection con=d.connect(driver location);

 
Is this answer useful? Yes | No
October 15, 2005 13:11:51   #4  
sudhakar        

RE: What are the steps for connecting to the database ...
it has two steps:1.load the class by using class.forName2.register the driver by using DriverManager class
 
Is this answer useful? Yes | No
October 18, 2005 08:22:39   #5  
safiya        

RE: What are the steps for connecting to the database ...
First we register the connection and after that we connect the database, in that we give to which database is connecting giving that  ipaddress ,port number,username and password .
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape