WebLogic Server Command Reference
The dbping
command-line utility tests the connection between a DBMS and your client machine via a JDBC driver. You must complete the installation of the driver before attempting to use this utility. For more information on how to install a driver, see the documentation from your driver vendor. Also see Setting the Environment for a Type-4 Third-Party JDBC Driver in Programming WebLogic JDBC.
With the WebLogic Type 4 JDBC Driver for DB2, you can also use the dbping
utility to create a package on the DB2 server. When you ping the database with the dbping utility, the driver automatically creates the default package on the database server if it does not already exist. If the default package already exists on the database server, the dbping
utility uses the existing package.
The default DB2 package includes 200 dynamic sections. You can specify a different number of dynamic sections to create in the DB2 package with the -d
option. The -d
option also sets CreateDefaultPackage=true
and ReplacePackage=true
on the connection used in the connection test, which forces the DB2 driver to replace the DB2 package on the DB2 server. (See DB2 Connection Properties for more information.) You can use the -d
option with dynamic sections set at 200
to forcibly recreate a default package on the DB2 server.
Notes: When you specify the -d
option, the dbping
utility recreates the default package and uses the value you specify for the number of dynamic sections. It does not modify the existing package.
To create a DB2 package, the user that you specify must have CREATE PACKAGE privileges on the database.
$ java utils.dbping
DBMS
[-ddynamicSections
]user
password
DB
C:\>java utils.dbping ORACLE_THIN scott tiger dbserver1:1561:demo
**** Success!!! ****
You can connect to the database in your app using:
java.util.Properties props = new java.util.Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("dll", "ocijdbc9");
props.put("protocol", "thin");
java.sql.Driver d =
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
java.sql.Connection conn =
Driver.connect("jdbc:oracle:thin:@dbserver1:1561:demo", props);