Testing connections
To use the utils.dbping utility, you must complete the installation of your JDBC driver. Make sure you have completed the following:
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
ExamplesOracleConnect 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_aliaswhere 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. 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
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
ExamplesThese 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 URLOracle 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 URLDB2 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.
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:
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.
|