Sun GlassFish Enterprise Server v3 Prelude Release Notes

Workaround

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.

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


Example 1–1 Creating a JDBC Connection Pool by Using the asadmin Utility

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