In some circumstances, an attempt to use the Administration Console to create a JDBC connection pool fails even if the driver is present. When this failure occurs, the Administration Console returns a server error such as HTTP Status 500.
For more information, see Issue report.
Repeat the attempt to create the JDBC connection pool, specifying the data-source class name explicitly. You can use either the Administration Console or the asadmin utility for this task.
If you use the Administration Console, see To Specify the Data-Source Class Name Explicitly When Using Administration Console.
If you use the asadmin utility, see To Create a JDBC Connection Pool in Sun GlassFish Enterprise Server v3 Prelude Administration Guide. In the create-jdbc-connection-pool(1) command, specify the --restype option and the --datasourceclassname option as follows:
The interface that the data-source class implements.
The name of the vendor-supplied JDBC data-source class.
For an example that shows how to set these options, see Example 1–1.
The required class name depends on the resource type. For example, for the MySQL database, the required class name for each resource type is as shown in Table 1–6.
For other database drivers, consult the documentation from the database driver vendor.
Table 1–6 Resource Types and Data-Source Class Names for the Driver for the MySQL Database
Resource Type |
Data-Source Class Name |
---|---|
javax.sql.ConnectionPoolDataSource |
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource |
javax.sql.DataSource |
com.mysql.jdbc.jdbc2.optional.MysqlDataSource |
javax.sql.XADataSource |
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource |
This example shows how to create a JDBC connection pool that is named mysql-pool for the MySQL database. The vendor-supplied JDBC data-source class is com.mysql.jdbc.jdbc2.optional.MysqlDataSource. This class implements the javax.sql.DataSource interface.
asadmin create-jdbc-connection-pool --datasourceclassname=com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype=javax.sql.DataSource --property="user=DBUSER:password=DBPASSWORD:url=jdbc\\:mysql\\://DB_HOSTNAME\\:3306/DATABASE_NAME" mysql-pool |
Perform this workaround only if an attempt to use the Administration Console to create a JDBC connection pool returns a server error such as HTTP Status 500. Use this workaround with the instructions for creating a JDBC connection pool in the Administration Console online help.
In the step for selecting a database vendor, do not select a vendor from the Database Vendor drop-down list.
You perform this step on the New JDBC Connection Pool (Step 1 of 2) page.
As a result of not selecting a vendor, the data source class name in the New JDBC Connection Pool (Step 2 of 2) page will not be filled in for you.
In the step for specifying the data-source class name, type the required class name in the Datasource Classname field.
You perform this step on the New JDBC Connection Pool (Step 2 of 2) page.
The required class name depends on the resource type that is selected from the Resource Type drop-down list. For example, for the MySQL database, the required class name for each resource type is as shown in Table 1–6.
For other database drivers, consult the documentation from the database driver vendor.
In the step for specifying additional properties, fill in the property table with the required property names and values.
You perform this step on the New JDBC Connection Pool (Step 2 of 2) page.
The required property names and values depend on the data-source class.