Monday, March 3, 2014

JDBC Introduction


JDBC:

Introduction:

JDBC provides set of standard Java API’s for connecting and performing transactions with RDBMS. Thus provides flexibility to java developers from switching to different data bases in the project life cycle without much effort.


 

Components of JDBC:

Following are key components of JDBC

1)      JDBC Driver:

JDBC Driver provides set of concrete classes that implement the interfaces defined by the JDBC API to interact with RDBMS. Each RDMS vendors have to implement certain interfaces defined by JDBC, thus each vendor comes up with his own JDBC driver implementation. For example MYSQL gives us their implementation of JDBC drivers and oracle comes up with its own implementation of the drivers. Thus this coding for interfaces provides the flexibility of changing the RDMS on the fly without much effort.

2)      Connections:

After the JDBC driver is loaded, the next step is to make connection to Database server. We can do this by obtaining the connection object of the JDBC API.

3)      Result Set:

Once we do a Read operation or a SELECT query on the RDBMS we get the result set containing the set of records for a particular query.

Although there are about 4 different types of Drivers named Tyep1, Type, Type3 and Type4, we generally deal with type 4 drivers which is a pure java implemented drivers. The Sun Oracle defines certain interfaces and all the different data base vendors have to implement this


standard imposed by SUN through these interfaces. This provides more flexibility as the data base can be changed without any / much changes to the source code and also the performance is much better compared to other Driver types. No need to mention that being a pure java implementation this makes the DB application platform independent.



 

 

 

 

 

 

 

 

No comments:

Post a Comment