Tuesday 23 April 2013

JDBC Features



JDBC

JDBC stands for "Java Database Connectivity” and it’s an Application Programming Interface (API) that provides universal database access for the Java programming language.  

 JDBC HISTORY
  • JDBC was released on February 19, 1997 as a part of JDK1.1 by Sun Microsystems. The JDBC 1.0 and JDBC 1.1 implementation version is JDK1.1.
  • 2nd Release of JDBC version 2.1 is happened in the year 1999 and the implementation version is JDK 1.2.
  • 3rd Release of JDBC version 3.0 is happened in the year 2001 and the implementation version was 1.4. The specification is provided in JSR 54.
  • 4th Release of JDBC version 4.0 is introduced in the year 2006 and the implementation version is J2SE6.0. The specification is provided in JSR 221.
The primary steps to get connectivity with database using our programs are:  
    • Load the driver and register it with the Driver Manager
    • Getting a connection with database
    • Create a statement
    • Execute a query and retrieve the results in result set object
    • Close the database connections.
Features of JDBC 1.0
  • The first official version of JDBC API was JDBC 1.0.
  • JDBC 1.0 includes a completely redesigned administration console with an enhanced GUI (Graphical  User Interface) to manage and monitor distributed virtual databases.
Features of JDBC 1.2
  • It supports Updatabale ResultSets.
  • Tweaks added through schedulers for increased performance.
  •  The DatabaseMetaData code has been modified to provide more transparency with regard to the underlying DB engine.
Features of JDBC 2.0
  •  JNDI concept is introduced to specify and obtain database connections. It allows us to make a pool of connections and we can reuse it repeatedly            
  •  DataSource interface is introduced for making a connection.
  •  This version contains the feature of Distrbuted transactions.
  •  Rowset technology  is introduced which provides a way of handling and passing data.
Features of the JDBC 2.1
  •  A feature of Scrollable Result Set is included or has the ability to move the Result Set to a specific row.
  • Enhanced support for storing persistent objects in the java.
  • Batch Execute feature was included or we can execute multiple SQL statements in a database as a combined unit.
  • With this release, we can directly update to a database table using JDBC API provided methods Instead of using SQL commands
  •  SQL3 data types are included with this release which is as column values. SQL3 types are Blob (Binary Large Objects), Clob (Character Large Objects), Array, Structured type, Ref.
  • Included supports for time zones in Date, Time, and Timestamp values.
  •  Full precision feature is included for java.math.BigDecimal values.
Features of JDBC 3.0
  •  Included feature of reusability of prepared statement by the use of connection pool.
  • An API related to DatabaseMetaData has been added.  
  • With this version a number of properties are defined for the ConnectionPoolDataSource. These properties can be used to describe how the PooledConnection objects created by DataSource objects.
  • Added a feature of retrieving values from columns containing automatically generated values(Retrieval of Auto Generated Key).
  • Updating BLOB and CLOB Data Types
  • Savepoints concept is introduced with this release.
  •  Included a feature of retrieval of parameterized metadata.
  •  A new data type is added as java.sql.BOOLEAN.
  •  Allowed to pass parameters to CallableStatement.
Features of JDBC 4.0 :
  •  Auto- loading of JDBC drivers means no need to use Class.forName() method any more.
  • SQL XML support
  •  Enhancements added for Connection management.
  • Included Support for SQL ROWID type:-  SQL ROWID identifies a row within a table and is the fastest way to access it. A new RowId interface has been added in this version to provide access to the ROWID SQL type from a Java class.
  • Annotations support is added for DataSet implementation of SQL.
  • Improved supports for SQL exception handling. 
  • Methods are added to JDBC4.0 API for the manipulation of Clob, Blob, Array, and Struct objects.
  • Provides support for SQL data types of NCHAR, NVARCHAR, LONGNVARCHAR, and NCLOB. They are analogous to CHAR, VARCHAR, LONGVARCHAR, and CLOB except for the fact that the values are encoded using different character sets, namely the national character set (NCS). Multiple setter and update methods are included to PreparedStatement, CallableStatement, and  ResultSet interfaces in order to provide support for NCS conversion.        
For example:- 
           Methods added for NCS  conversion are setNString, setNCharacterStream, and setNClob

          Read and write methods have been added to the SQLInput and SQLOutput interfaces to support 
          NClob and NString objects.
  • JDBC 4.0 introduces the concept of wrapped JDBC objects
  • ResultSet Becomes more flexible :- RowSet sub-interface provides a scrollable, updatable, and offline-editable ResultSet. The WebRowSet sub-interface provides the ability to read  data from database tables, serialize them to an XML  document, and deserialize from XML back to result set.


JDBC-to-databse interaction

No comments:

Post a Comment