Wednesday, October 2, 2013

JDBC configuration

Basics on Weblogic JDBC:


First we need to configure database connectivity by configuring data source  or multi datasource and then need to target to jdbc resources to servers and clusters in weblogic domain.

Each data source that you configure contains a pool of database connections that are created when the data source instance is created—when it is deployed or targeted, or at server startup. Applications lookup a data source on the JNDI tree or in the local application context (java:comp/env), depending on how you configure and deploy the object, and then request a database connection. When finished with the connection, the application calls connection.close(), which returns the connection to the connection pool in the data source.

A multi data source is an abstraction around a data sources that provides load balancing or failover processing between the data sources associated with the multi data source.

You create and manage JDBC resources either as system modules or as application modules. JDBC application modules are a WebLogic-specific extension of Java EE modules and can be configured either within a Java EE application or as stand-alone modules.


JDBC datasource having two types:

1)System module
2)Application module

1.System Module:
System module stored under config/jdbc sub directory and it will pointed to config.xml file. System modules, normally we can use for entire domain. JDBC module conforms weblogic-jdbc.xsd schema.
System modules can create and use through weblogic console as administrator. When we create system module , we can able to use for complete domain or any application or cluster and therefore are available to all applications deployed on the same targets and to client applications.

Example:

under config.xml

<jdbc-system-resource>
<name>test-dsource</name>
<target>anyserver</target>
</jdbc-system-resource>

under
 config/jdbc:

<jdbc-data-source>
<name>test-dsource</name>
.
.
.
.
</jdbc-data-source>

2.Application Module:

For application module based JDBC owned by developer, they package these type of modules with enterprise applications (EAR) and it pointed to  weblogic-application.xml and ejb-jar.xml deployment descriptors. As administrator, we just need to deploy the .ear package and we no need to configure JDBC settings for application module.



Please let us know, if any issues or any typos.