Monday, November 19, 2012

JDBC Data Sources in WebLogic Server

JDBC


  • It is an API which is used for accessing the Databases.
  • JDBC provides Platform independent access to databases


JDBC Data Source

In WebLogic Server, you can connect to database by adding JDBC data sources to your WebLogic domain

  • A JDBC data source is an object bound to the JNDI tree that provides database connectivity through a pool of JDBC connections. 
  • Applications can look up a data source on the JNDI tree and then borrow a database connection from a data source.
  • A Data Source:
      • Is stored in the WLS JNDI tree
      • Is associated with a connection pool
      • Can support transactions


What is Connection Pool?

 It's a pool of connection objects which provides the connectivity between WebLogic Server and Database. It allows an application to borrow a database connection.

Advantages of Connection Pools and Data Sources

Connection pools are created at WebLogic Server startup. It provides
  1. Re-usability
  2. Readily available connections (Time and overhead are saved by using an existing database connection)
  3. Can be dynamically resized to accommodate increasing load
  4. The database can be changed without application developer having to modify the underlying code
  5. The number of connections to a database can be controlled

Types of Data Sources

  1. Generic Data Source - It is nothing but a Data Source. It provides database connectivity through pool of JDBC Connections.
  2. Multi Data Source - It is abstraction around a group of data sources which provides  Load balancing or Failover. It determines which data source to use to satisfy the request depending on the algorithm selected in the Multi Data Source Configuration.
  3. Grid Link Data Soure - It provides connectivity between WebLogic Server and an Oracle Database service targeted to an Oracle Real Application Cluster (RAC). It uses the Oracle Notification Service (ONS) to adaptively respond to state changes in an Oracle RAC instance