Index Changes
This is version 32. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Setting Up Database Access

Follow these steps:
1   Make the driver's JAR file accessible to the domain's server instance. See To Integrate a JDBC Driver.

2   Create a connection pool for the database. See To Create a JDBC Connection Pool.

3   Create a JDBC resource that points to the connection pool. See To Create a JDBC Resource.

Integrating a JDBC Driver

A JDBC driver translates an application's JDBC calls into the protocol of the database server.

To integrate the JDBC driver into an administrative domain, perform either of the following:

TIJDBCDDB ToIntegrateaJDBCDriver

To Integrate a JDBC Driver

1    Make the driver accessible to the common class loader.

2    Copy the driver's JAR and ZIP files into the domain-dir/lib directory or copy its class files into the domain-dir/lib/ext directory.

3    Restart the domain.

4    Make the driver accessible to the system class loader.

Creating a JDBC Connection Pool

When creating the pool with the Admin Console, you are actually defining the aspects of a connection to a specific database. A JDBC connection pool is a group of reusable connections for a particular database. Because creating each new physical connection is time consuming, the server maintains a pool of available connections to increase performance. When an application requests a connection, it obtains one from the pool. When an application closes a connection, the connection is returned to the pool.

Before creating the pool, you must first install and integrate the JDBC driver. See To Integrate a JDBC Driver.

When creating the Create Connection Pools, certain data specific to the JDBC driver and the database vendor must be specified. Before proceeding, gather the following information:

  • Database vendor name
  • Resource type, such as
    • javax.sql.DataSource (local transactions only)
    • java.sql.ConnectionPoolDataSource (local transactions, possible performance improvements)
    • javax.sql.XADataSource (global transactions)
  • Data source class name
  • Required properties, such as the database name (URL), user name, and password

TCJDBCCDB ToCreateaJDBCConnectionPool

To Create a JDBC Connection Pool

1    Select the Common Tasks node, then click Resources —> JDBC —> Connection Pool.

Note - Select New to create a new connection pool from the New Connection Pool page.

2    Specify the General Settings as follows:
  a    Name: Specify a Name for the pool.
        For example, mysqlpool
  b    Resource Type: Select a Resource Type from the drop-down menu.
         Choices include
          *    javax.sql.XADataSource (global transactions),
          *    java.sql.ConnectionPoolDataSource (local transactions, possible performance improvements).
          *    javax.sql.DataSource (local transactions only).
  c    Database Vendor: Select a vendor from the list provided in the drop-down menu.
         For example, mySQL

Image shows ...

3    Click Next.

4    Specify the additional General Settings as follows:

  • Datasource Classname: If the JDBC driver has a Datasource class for the resource type and database vendor specified in the previous page, then the value of the Datasource Classname field is provided.
       For example, MySQL : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
  • Description: A text description of the connection pool.

Image shows ...

5    Specify the Pool Settings.
        The values are entered, by default.

6    Specify the Connection Validation.
        The values are entered, by default.

7    Specify the Transaction Isolation settings.
        The values are entered, by default.

8    Add the required properties in the Additional Properties table, such as database name (URL), user name, and password. Enter the following.
  a    databaseName
  b    password
  c    portNumber
  d    serverName
  e    user

Image shows ...

9    Click Finish.

TCJDBCRDB ToCreateaJDBCResource

To Create a JDBC Resource

Applications get a database connection from a connection pool by looking up a data source on the Java Naming and Directory Interface (JNDI) tree and then request a connection. The connection pool associated with the datasource provides the connection to the application.

Before You Begin

Before creating a JDBC resource, first create a JDBC connection pool. See To Create a JDBC Connection Pool.
1    Expand the Resources, then JDBC path node.

2    Select the JDBC Resources node.

3    Click New from the JDBC Resources page.

4    Specify the Resource settings as follows:
  a    JNDI Name: Specify a unique name. The JNDI name organizes and locates components within a distributed computing environment similarly to the way that card catalogs organize and represent locations of books in a library. Consequently, the JNDI name becomes an important method of accessing the JDBC resource. By convention, the name begins with the jdbc/string.
        For example: jdbc/payrolldb.

Note - Remember to give a forward slash.

  b    Pool Name: Choose the connection pool to be associated with the new JDBC resource.
  c    Description: Type a short description of the resource.
  d    Status: If you want the resource to be unavailable, deselect the Enabled checkbox. By default, the resource is available (enabled) as soon as it is created.

5    Click OK.

Image shows ...



See Also



Return to Using the Database Binding Component

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This particular version was published on 15-Dec-08 11:56 AM, -0800 by PRABHAMS