The purpose of this article is to provide steps on how to test Oracle database connectivity using the Oracle Java Database Connectivity (JDBC) jar file.
Using the JDBC to connect to the Oracle Database allows for more accurate results as opposed to testing via telnet or ping since it allows for full connectivity.
SQLPlus is also an option, however, in most cases SQLPlus would not be installed on the CDP server.
Steps:
Syntax:
java -cp .:./ojdbc6.jar OracleJdbcDbTest jdbc:oracle:thin:@address/hostname:oracle_sid <username> <password>
Examples:
java -cp .:./ojdbc6.jar OracleJdbcDbTest jdbc:oracle:thin:@192.168.50.100:1521:cdp_db psys_cluster root1pass
java -cp .:./ojdbc6.jar OracleJdbcDbTest jdbc:oracle:thin:@prodoracledb:1521:cdp_db psys_cluster root1pass
Results:
Successful connections should provide Date/Time from the Oracle Server
ie:
Current Date from Oracle : 2015-11-05 12:10:12
done