• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Weblogic JDBC

At the end of this chapter you will be able to:

  • Describe the high level architecture of JDBC
  • List the four driver types and those provide by WLS
  • Describe and configure Data Sources
  • Use the Administration Console to manage JDBC resources


Overview of JDBC


What Is JDBC?

  • JDBC is an API for accessing databases in a uniform way.


  • JDBC provides:
    • Platform independent access to databases
    • Location transparency
    • Transparency to proprietary database issues
    • Support for both two-tier and multi-tier models for database access


JDBC Architecture


JDBC Drivers:

Type 1 Driver

  • The Type 1 driver:
    • Is a JDBC-ODBC bridge
    • Usually runs on Windows
    • Requires ODBC driver to be installed on client machine




Type 2 Drivers

  • The Type 2 driver:
    • Requires a native driver to be already installed on the client machine
    • The driver converts JDBC calls to native API calls of the database.




Type 3 Drivers

  • A network server can apply several techniques to boost performance:
    • Connection pooling
    • Load management





Type 4 Drivers

  • Type 4 drivers are ‘all-Java’ driver implementations that do not require client side configuration.



Two-Tier Architecture

  • In the two-tier model a Java application communicates directly with the DBMS.
  • A JDBC driver is needed that can communicate directly with the DBMS.
  • This is a client/server configuration.



Multi-Tier Architecture

  • In the multi-tier model, commands are sent to a “middle tier” of services, which then sends the commands to the DBMS.
  • The DBMS processes the commands and sends the results back to the middle tier, which then sends them to the client.


Choosing the Correct Driver

  • Choosing the correct driver can have significant impact on performance.
  • For two-tier applications use the type 1, 2 or 4 driver specific to the DBMS you are using.
  • For multi-tier applications use:
    • Data Source lookup in a client class
    • A type 1, 2 or 4 driver on the server, specific to the DBMS you are using
    • XA driver where transaction support is required


Data Sources:

What Is a Data Source?

  • A Data Source object provides a way for a JDBC client to obtain a database connection from a connection pool.
  • A Data Source:
    • Is stored in the WLS JNDI tree
    • Can support transactions
    • Is associated with a connection pool

What Is a Connection Pool?

  • A connection pool is a group of ready-to-use database connections associated with a Data Source.
  • Connection pools:
    • Are created at WebLogic Server startup
    • Can be administered using the Administration Console
    • Can be dynamically resized to accommodate increasing load


Benefits of Data Sources and Connection Pools

  • Some advantages of this approach are:
    • Time and overhead are saved by using an existing database connection
    • Connection information is managed in one location in the Administration Console
    • The number of connections to a database can be controlled
    • The DBMS can be changed without the application developer having to modify underlying code
  • A connection pool allows an application to “borrow” a DBMS connection.


JDBC Data Source Architecture



Modular Configuration and Deployment of JDBC Resources

  • JDBC configurations in WLS are stored in XML documents:
    • All JDBC configurations must conform to the new weblogic-jdbc.xsd schema.
    • IDEs and other tools can validate JDBC modules based on the schema.
  • You create and manage JDBC resources either as system modules or as application modules.
  • JDBC application modules are a WLS-specific extension of J2EE modules and can be deployed either within a J2EE application or as stand-alone modules.


How Data Sources Are Used

  • A client retrieves a Data Source through JNDI look up and uses it to obtain a database connection.


Creating a JDBC Data Source…




Creating a Data Source: Properties


Creating a Data Source: XA Options


Creating a Data Source: ConnectionProperties


Creating a Data Source: Test Database Connections & Select Targets:




Configuring a Connection Pool…





Connection Pool Checklist

  • You can modify a connection pool after the Data Source has been created
  • Before modifying a connection pool, you should understand:
    • The JDBC URL of the database
    • The connection properties used to authenticate a user or optionally configure the driver
  • Ask your DBA for:
    • The maximum number of connections your application will be allowed



  • Database locations are specified using a JDBC Uniform Resource Locator (URL).






Multi Data Sources…

  • Multi Data Source:
    • It is an abstraction around a group of data sources
    • Determines which data source to use to satisfy the request depending on the algorithm selected in the multi data source configuration:
      • Load balancing Or • Failover
    • Are bound to the JNDI tree
  • XA Support for Multi Data Sources
    • The WLS JDBC supports using Multi Data Sources in XA transactions.
    • You can configure the data sources contained within the Multi Data Source to use XA JDBC drivers.



Monitoring & Testing Data Sources

Monitoring Data Sources: Statistics

  • The Administration console provides two types of data source monitoring: statistics and testing.



Monitoring Data Sources: Testing

  • The Administration console provides a mechanism for manually testing individual data sources.





In this chapter we discussed:

  • JDBC high level architecture
  • WebLogic Server provided JDBC driver types
  • Data Source definition and workings
  • Connection pool definition and workings
  • Managing JDBC resources with the Administration Console







Review Date
Reviewed Item
Weblogic JDBC
Author Rating

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Weblogic JDBC"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.