To prepare a JDBC resource for use in Java EE applications deployed to the Enterprise Server, perform the following tasks:
For information about how to configure some specific JDBC drivers, see Configurations for Specific JDBC Drivers in Sun GlassFish Enterprise Server v2.1.1 Administration Guide.
To use JDBC features, you must choose a JDBC driver to work with the Enterprise Server, then you must set up the driver. This section covers these topics:
Supported JDBC drivers are those that have been fully tested by Sun. For a list of the JDBC drivers currently supported by the Enterprise Server, see the Sun GlassFish Enterprise Server v2.1.1 Release Notes. For configurations of supported and other drivers, see Configurations for Specific JDBC Drivers in Sun GlassFish Enterprise Server v2.1.1 Administration Guide.
Because the drivers and databases supported by the Enterprise Server are constantly being updated, and because database vendors continue to upgrade their products, always check with Sun technical support for the latest database support information.
To integrate the JDBC driver into a Enterprise Server domain, copy the JAR files into the domain-dir/lib directory, then restart the server. This makes classes accessible to all applications or modules deployed on servers that share the same configuration. For more information about Enterprise Server class loaders, see Chapter 2, Class Loaders.
When you create a connection pool that uses JDBC technology (a JDBC connection pool) in the Enterprise Server, you can define many of the characteristics of your database connections.
You can create a JDBC connection pool in one of these ways:
In the Admin Console, open the Resources component, open the JDBC component, and select Connection Pools. For details, click the Help button in the Admin Console.
Use the asadmin create-jdbc-connection-pool command. For details, see the Sun GlassFish Enterprise Server v2.1.1 Reference Manual.
For a complete description of JDBC connection pool features, see the Sun GlassFish Enterprise Server v2.1.1 Administration Guide
You can test a JDBC connection pool for usability in one of these ways:
In the Admin Console, open the Resources component, open the JDBC component, select Connection Pools, and select the connection pool you want to test. Then select the Ping button in the top right corner of the page. For details, click the Help button in the Admin Console.
Use the asadmin ping-connection-pool command. For details, see the Sun GlassFish Enterprise Server v2.1.1 Reference Manual.
Both these commands fail and display an error message unless they successfully connect to the connection pool.
For information about how to tune a connection pool, see the Sun GlassFish Enterprise Server v2.1.1 Performance Tuning Guide.
A JDBC resource, also called a data source, lets you make connections to a database using getConnection(). Create a JDBC resource in one of these ways:
In the Admin Console, open the Resources component, open the JDBC component, and select JDBC Resources. For details, click the Help button in the Admin Console.
Use the asadmin create-jdbc-resource command. For details, see the Sun GlassFish Enterprise Server v2.1.1 Reference Manual.