JDBC (Java DataBase Connectivity ) in Oracle WebLogic – Overview

This post covers overview of connecting WebLogic Server to Database using JDBC.

How to connect to Database from Oracle WebLogic Server :
You first create JDBC Datasource (or multi data sources) and then deploy this JDBC datasource (or multi datasource) to WebLogic Server (or cluster) in Domain.

Datasource: contains pool of database connections that are created when datasource instance is created i.e.
a) When it is deployed or targeted
or
b) Server start-up

Multi Datasource : Abstraction around data source to provide load balancing or failover for datasource which are part of Multi Datasource.

.
Who can create JDBC Resource – Administrator or Programmer

How a JDBC resource is created – Using
i) Administration Console (by Administrator)
ii) WLST (WebLogic Scripting Tool)  (by Administrator)
iii) by Programmatically using JMX API (by Developer)

System v/s Application JDBC Module – JDBC Modules created by Administrator using Console or WLST are called as System JDBC module where as JDBC module created by developer using WebLogic Workshop, other IDE (Integrated Development Environment) or XML editor are called as Application JDBC Module.

How JDBC Datasource is stored on server – as XML File under $DOMAIN/config/jdbc directory. i.e. $WEBLOGIC_HOME/ user_projects/ domains/ [domain_name]/ config/ jdbc/

config.xml file in “$WEBLOGIC_HOME/user_projects/domains/[domain_name]/config” points to JDBC datasource configuration file via parameter jdbc-system-resource

sample entry in config.xml

  <jdbc-system-resource>
    <name>JDBC1</name>
    <target>AdminServer</target>
    <descriptor-file-name>jdbc/JDBC1-1894-jdbc.xml</descriptor-file-name>
  </jdbc-system-resource>

which means JDBC configuration file is at “$WEBLOGIC_HOME/ user_projects/ domains/ [domain_name]/ config/ jdbc/ JDBC1-1894-jdbc.xml

.

Step by Step JDBC resource creation (for database connectivity) in WebLogic Server using Administration Console coming next …

About the Author Masroof Ahmad

Leave a Comment:

5 comments
Add Your Reply