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 |