Showing posts with label JDBC Bridge. Show all posts
Showing posts with label JDBC Bridge. Show all posts

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

When would you use a JDBC-ODBC Bridge?

Answer:
When ever someone wants to access microsoft oriented databases such as MS Access MS SQL server you have to use the JDBC-ODBC bridge. In general it is recommended not to use this type of bridge