4.7.3 Setting up a connection to the database server
To set up a connection to the database server, create a JDBC connection pool using the create-jdbc-connection-pool subcommand of the asadmin utility command, and then create a JDBC resource using the create-jdbc-resource subcommand.
Prerequisites
-
The domain administration server (DAS) is running.
-
Application Server is running.
-
The database server (DBMS) is running.
-
The JDBC driver has been installed for Application Server.
Intended users
-
System engineers
Procedure
To create a JDBC connection pool, run the create-jdbc-connection-pool subcommand of the asadmin utility command.
asadmin create-jdbc-connection-pool connection_pool_setting unique_connection_destination_vendor_setting connection_pool_ID
-
The size of the connection pool and the connection trouble detection function are set in the connection_pool_setting by using the subcommand options.
-
The driver-specific information provided by the database vendor is set in unique_connection_destination_vendor_setting by using the subcommand options.
-
The name used to identify the JDBC connection pool is set in connection_pool_ID.
- (Example 1) For Oracle:
-
asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --restype javax.sql.DataSource --property user=user_name:password=password: url="jdbc\:oracle\:thin\:@IP_address\:port_number\:Oracle_SID" connection_pool_name
When this command is run, the result is displayed as follows:
JDBC connection pool connection_pool_ID created successfully. Command create-jdbc-connection-pool executed successfully.
-
To create a JDBC resource for all server instances in a cluster, run the create-jdbc-resource subcommand of the asadmin utility command.
asadmin create-jdbc-resource --connectionpoolid connection_pool_ID --target server_instance_name_or_cluster_name JNDI_name
-
In a configuration where only one Java EE server is deployed, the server instance name for the --target option.
-
In a cluster configuration where more than one Java EE server is deployed, specify the cluster name for the --target option.
-
The name required to acquire the connection of the database server (DBMS) is specified in JNDI_name.
When this command is run, the result is displayed as follows:
JDBC resource JNDI_name created successfully. Command create-jdbc-resource executed successfully.
-
Postrequisites
-
Testing the connection to the database server