dbping
The dbping
command-line utility tests the connection between a DBMS and your client
machine via a JDBC driver.
Syntax
$ java utils.dbping
ORACLE_THIN USERNAME PASSWORD IP:PORT:SID
Example
[oracle@oracle ~]$ bin
[oracle@oracle bin]$ pwd
/mnt/Oracle/Middleware/user_projects/domains/basedomain/bin
[oracle@oracle bin]$ ll
total 2.1M
drwxr-x--- 2 oracle fmw 1.0K Jul 20 02:17 nodemanager
drwxr-x--- 2 oracle fmw 80 Jul 20 02:17 server_migration
drwxr-x--- 2 oracle fmw 80 Jul 20 02:17 service_migration
-rwxr-x--- 1 oracle fmw 2.0K Jul 20 02:17 secureWebLogic.sh
-rwxr-x--- 1 oracle fmw 2.0K Jul 20 02:17 stopWebLogic.sh
-rwxr-x--- 1 oracle fmw 3.2K Jul 20 02:17 startManagedWebLogic.sh
-rwxr-x--- 1 oracle fmw 2.4K Jul 20 02:17 stopManagedWebLogic.sh
-rwxr-x--- 1 oracle fmw 17K Jul 20 02:17 setDomainEnv.sh
-rwxr-x--- 1 oracle fmw 5.7K Jul 20 02:17 startWebLogic.sh
-rw------- 1 oracle fmw 686K Aug 7 02:25 nohup.out
[oracle@oracle bin]$ . ./setDomainEnv.sh
[oracle@oracle basedomain]$ java utils.dbping ORACLE_THIN PRD_IPM PRD_IPM 172.24.146.88:1521/xe
[oracle@oracle bin]$ pwd
/mnt/Oracle/Middleware/user_projects/domains/basedomain/bin
[oracle@oracle bin]$ ll
total 2.1M
drwxr-x--- 2 oracle fmw 1.0K Jul 20 02:17 nodemanager
drwxr-x--- 2 oracle fmw 80 Jul 20 02:17 server_migration
drwxr-x--- 2 oracle fmw 80 Jul 20 02:17 service_migration
-rwxr-x--- 1 oracle fmw 2.0K Jul 20 02:17 secureWebLogic.sh
-rwxr-x--- 1 oracle fmw 2.0K Jul 20 02:17 stopWebLogic.sh
-rwxr-x--- 1 oracle fmw 3.2K Jul 20 02:17 startManagedWebLogic.sh
-rwxr-x--- 1 oracle fmw 2.4K Jul 20 02:17 stopManagedWebLogic.sh
-rwxr-x--- 1 oracle fmw 17K Jul 20 02:17 setDomainEnv.sh
-rwxr-x--- 1 oracle fmw 5.7K Jul 20 02:17 startWebLogic.sh
-rw------- 1 oracle fmw 686K Aug 7 02:25 nohup.out
[oracle@oracle bin]$ . ./setDomainEnv.sh
[oracle@oracle basedomain]$ java utils.dbping ORACLE_THIN PRD_IPM PRD_IPM 172.24.146.88:1521/xe
OUTPUT
**** Success!!! ****
You can connect to
the database in your app using:
java.util.Properties
props = new java.util.Properties();
props.put("user", "PRD_IPM");
props.put("password", "PRD_IPM");
java.sql.Driver d =
Class.forName("oracle.jdbc.OracleDriver").newInstance();
java.sql.Connection conn =
Driver.connect("jdbc:oracle:thin:@172.24.146.88:1521/xe", props);
props.put("user", "PRD_IPM");
props.put("password", "PRD_IPM");
java.sql.Driver d =
Class.forName("oracle.jdbc.OracleDriver").newInstance();
java.sql.Connection conn =
Driver.connect("jdbc:oracle:thin:@172.24.146.88:1521/xe", props);