BEA Logo BEA WebLogic Server Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

Testing connections

Contents
Validating a DBMS connection from the command line
How to test a two-tier connection from the command line
How to validate a multitier WebLogic JDBC connection from the command line
Troubleshooting

Validating a DBMS connection from the command line

BEA provides utilities that you can use to test two-tierWhat's two-tier? and three-tier JDBC database connections after you install WebLogic two-tier drivers, a WebLogic Server, or WebLogic JDBCWhat's WebLogic JDBC? .

How to test a two-tier connection from the command line

To use the utils.dbping utility, you must complete the installation of your JDBC driver. Make sure you have completed the following:

  • For type-2 JDBC drivers, such as WebLogic jDriver for Oracle, set your PATH (Windows NT) or shared/load library path (Unix) to inculde both your DBMS-supplied client installation and the BEA-supplied native libraries.

  • For all drivers, include the classes of your JDBC driver in your CLASSPATH.

Installation instructions for the BEA WebLogic jDriver JDBC drivers are available at:

Use the utils.dbping utility to confirm that you can make a connection between Java and your database. The dbping utility is only for testing a two-tier connection, using a WebLogic two-tier JDBC driver like WebLogic jDriver for Oracle.

Syntax

  $ java utils.dbping DBMS user password DB

Arguments

DBMS
Use: ORACLE, MSSQLSERVER4, or INFORMIX4
user
Valid username for database login. Use the same values and format that you use with isql for SQL Server, sqlplus for Oracle, or DBACCESS for Informix.
password
Valid password for the user. Use the same values and format that you use with isql, sqlplus, or DBACCESS.
DB
Name of the database. The format varies depending on the database and version. Use the same values and format that you use with isql, sqlplus, or DBACCESS. Type 4 drivers, such as MSSQLServer4 and Informix4, need additional information to locate the server since they cannot access the environment.

Examples

Oracle

Connect to Oracle from Java with WebLogic jDriver for Oracle using the same values that you use with sqlplus.

If you are not using SQLNet (and you have ORACLE_HOME and ORACLE_SID defined), follow this example:

  $ java utils.dbping ORACLE scott tiger

If you are using SQLNet V2, follow this example:

  $ java utils.dbping ORACLE scott tiger TNS_alias
where TNS_alias is an alias defined in your local tnsnames.ora file.

Microsoft SQL Server (type 4 driver)

To connect to Microsoft SQL Server from Java with WebLogic jDriver for SQL Server, you use the same values for user and password that you use with isql. To specify the SQL Server, however, you supply the name of the computer running the SQL Server and the TCP/IP port the SQL Server is listening on. To log into a SQL Server running on a computer named mars listening on port 1433, type:

  $ java utils.dbping MSSQLSERVER4 sa secret mars:1433

You could omit ":1433" in this example since 1433 is the default port number for Microsoft SQL Server.

Informix (type 4 driver)

Connect to Informix from Java with WebLoigc jDriver for Informix using the same values that you use with DBACCESS. The order of arguments follows the pattern:

  $ java utils.dbping INFORMIX user pass db@server:port

As shown in this example:

  $ java utils.dbping INFORMIX bill secret stores@myserver:8543

Top of the page

How to validate a multitier WebLogic JDBC connection from the command line

Use the utils.t3dbping utility to confirm that you can make a multitierWhat's multitier? database connection using a WebLogic Server. The t3dbping utility is only for testing a multitier connection, after you have verified that you have a working two-tier connection, and after you have started WebLogic.

If the two-tier JDBC driver is a WebLogic jDriver, you should test the two-tier connection with utils.dbping. Otherwise, see the documentation for the two-tier JDBC driver to find out how to test that connection before you test the multitier connection.

Syntax

  $ java utils.t3dbping URL user password DB driver_class driver_URL

Arguments

URL
URL of the WebLogic Server. For more information on constructing a WebLogic URL, check Running and maintaining the WebLogic Server.
username
Valid username for the DBMS.
password
Valid password for that user.
DB
Name of the database. Use the same values and format that are shown above for testing a two-tier connection.
driver_class
Class name of the JDBC driver between WebLogic and the DBMS. For instance, if you are using WebLogic jDriver for Oracle on the server side, the driver class name is weblogic.jdbc.oci.Driver. Note that the class name of the driver is in dot-notation format.
driver_URL
URL of the JDBC driver between WebLogic and the DBMS. For instance, if you are using WebLogic jDriver for Oracle on the server side, the URL of the driver is jdbc:weblogic:oracle. Note that the URL of the driver is colon-separated.

Examples

These examples are displayed on multiple lines for readability. Each example should by entered as a single command.

Oracle

Here is an example of how to ping the Oracle DBMS DEMO20 running on the server bigbox, on the same host as WebLogic, which is listening on port 7001:

  $ java utils.t3dbping          // command
       t3://bigbox:7001          // WebLogic URL
       scott tiger               // user password
       DEMO20                    // DB
       weblogic.jdbc.oci.Driver  // driver class
       jdbc:weblogic:oracle      // driver URL
Oracle with ODBC

This example shows how to ping an Oracle database using the JDBC-ODBC bridge:

  $ java utils.t3dbping             // command
       t3://bigbox:7001             // WebLogic URL
       scott tiger                  // user password
       ""                           // DB
       sun.jdbc.odbc.JdbcOdbcDriver // driver class
       jdbc:odbc:VISIORA73          // driver URL
DB2 with AS/400 type 4 JDBC driver

This example shows how to ping an AS/400 DB2 database from a workstation command shell using the IBM AS/400 type 4 JDBC driver:

  $ java utils.t3dbping                      // command
       t3://as400box:7001                    // WebLogic URL
       scott tiger                           // user password
       DEMO                                  // database 
       com.ibm.as400.access.AS400JDBCDriver  // driver class
       jdbc:as400://as400box                 // driver URL

WebLogic jDriver for Microsoft SQL Server (type 4 JDBC driver)

This example shows how to ping a Microsoft SQL Server database using WebLogic jDriver for Microsoft SQL Server:

$ java utils.t3dbping                // command
   t3://localhost:7001               // WebLogic URL
   sa                                // user name
   abcd                              // password
   database                          // database@hostname:port 
                                        (optional if specified as part of the URL)
   weblogic.jdbc.mssqlserver4.Driver // driver class
   jdbc:weblogic:mssqlserver4:pubs@localhost:1433
                                     // driver URL:database@hostname:port 
                                        (optional if used in the database parameter)
For information on other WebLogic commands, see Running and maintaining the WebLogic Server.

Top of the page

Troubleshooting

If you are testing a connection to WebLogic, check the WebLogic log. By default, the log is kept in a file called weblogic.log in the weblogic/myserver directory.

UNIX users

If you encounter a problem trying to load native_login, use truss to determine the source of the problem. For example, to run tutorial.example3, type:

  $ truss -f -t open -s\!all java tutorial.example3

WinNT/Windows95 users

If you get an error message that indicates that the .dll failed to load, make sure your PATH includes the 32-bit database-related .dlls.

 

Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
Last updated 01/13/2000