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

 Print  |  
Question:  What are the steps for connecting to the database using JDBC

Answer:
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


July 07, 2005 12:39:11 #2
 mahesh   Member Since: Visitor    Total Comments: N/A 

RE: What are the steps for connecting to the database using JDBC
 
What tw xml files inservlets?
     

 

Back To Question