Skip navigation.

WebLogic Server Command Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents Index View as PDF   Get Adobe Reader

 


dbping

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.

Creating a DB2 Package with dbping

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.

Syntax

$ java utils.dbping DBMS [-d dynamicSections] user password DB

Argument

Definition

DBMS

Varies by DBMS and JDBC driver:

DB2B—WebLogic Type 4 JDBC Driver for DB2

JCONN2—Sybase JConnect 5.5 (JDBC 2.0) driver

JCONNECT—Sybase JConnect driver

INFORMIXB—WebLogic Type 4 JDBC Driver for Informix

MSSQLSERVER4—WebLogic jDriver for Microsoft SQL Server

MSSQLSERVERB—WebLogic Type 4 JDBC Driver for Microsoft SQL Server

ORACLE—WebLogic jDriver for Oracle

ORACLEB—WebLogic Type 4 JDBC Driver for Oracle

ORACLE_THIN—Oracle Thin Driver

POINTBASE—PointBase Universal Driver

SYBASEB—WebLogic Type 4 JDBC Driver for Sybase

[-d dynamicSections]

Specifies the number of dynamic sections to create in the DB2 package. This option is for use with the WebLogic Type 4 JDBC Driver for DB2 only.

If the -d option is specified, the driver automatically sets CreateDefaultPackage=true and ReplacePackage=true on the connection and creates a DB2 package with the number of dynamic sections specified.

user

Valid database username for login. Use the same values you use with isql, sqlplus, or other SQL command-line tools.

For DB2 with the -d option, the user must have CREATE PACKAGE privileges on the database.

password

Valid database password for the user. Use the same values you use with isql or sqlplus.

DB

Name and location of the database. Use the following format, depending on which JDBC driver you use:

DB2B—Host:Port/DBName

JCONN2—Host:Port/DBName

JCONNECT—Host:Port/DBName

INFORMIXB—Host:Port/DBName/InformixServer

MSSQLSERVER4—Host:Port/DBName or [DBName@]Host[:Port]

MSSQLSERVERB—Host:Port/DBName

ORACLE—DBName (as listed in tnsnames.ora)

ORACLEB—Host:Port/DBName

ORACLE_THIN—Host:Port/DBName

POINTBASE—Host[:Port]/DBName

SYBASEB—Host:Port/DBName


Where:

  • Host is the name of the machine hosting the DBMS,

  • Port is port on the database host where the DBMS is listening for connections, and

  • DBName is the name of a database on the DBMS.

  • InformixServer is an Informix-specific environment variable that identifies the Informix DBMS server.


 

Example

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);

 

Skip navigation bar  Back to Top Previous Next