|
|
Testing connections
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 jdbcKona/Oracle. Syntax$ java utils.dbping DBMS user password DB Arguments
ExamplesOracleConnect to Oracle from Java with jdbcKona/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. Sybase Connect to Sybase from Java with jdbcKona/Sybase using the same values that you use with isql. If you log into isql using isql -Usa -Psecret -SDEMO, type: $ java utils.dbping SYBASE sa secret DEMOMicrosoft SQL Server (type 2 driver) Connect to Microsoft SQL Server from Java with jdbcKona/MSSQLServer using the same values that you use with isql. If you log in with isql using isql -Usa -Psecret -SDEMO, type: $ java utils.dbping MSSQLSERVER sa secret DEMOMicrosoft SQL Server (type 4 driver) To connect to Microsoft SQL Server from Java with jdbcKona/MSSQLServer4, 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 jdbcKona/Informix4 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 jdbcKona driver, 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 URL
Sybase
This example shows how to ping the Sybase DBMS DEMODB 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
sa secret // user password
DEMODB // DB
weblogic.jdbc.dblib.Driver// driver class
jdbc:weblogic:sybase // driver URL
MSSQLServer
This example shows how to ping the Microsoft MS SQL Server DBMS DEMODB 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
sa secret // user password
DEMODB // DB
weblogic.jdbc.dblib.Driver// driver class
jdbc:weblogic:mssqlserver // 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
For information on other WebLogic commands, see Running and maintaining the WebLogic Server. 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.
|