Testing Oracle jdbc connection with jdbc-tester.jar.

book

Article ID: 221075

calendar_today

Updated On:

Products

CA Automic One Automation

Issue/Introduction

How to test the Oracle jdbc connection? 

Cause

Configuration.

Environment

Release : 12.2., 12.3

Component : AUTOMATION ENGINE

Resolution

The jdbc-tester-1.1.jar can be used for a quick Oracle jdbc connect string test.

Syntax:

java -jar target/jdbc-tester-1.0.jar <schema_name> <schema_password> jdbc:oracle:thin:@//<host>:<port>/<SID>

The most current version can be downloaded here: https://github.com/aimtiaz11/oracle-jdbc-tester

Additional Information

Example for a successful test result:

[[email protected] bin]$ java -jar jdbc-tester-1.1.jar Automic Automic1 jdbc:oracle:thin:@//lvntest021348:1521/orclpdb
21:45:36.207 [main] INFO Main - arg 0 = Automic
21:45:36.218 [main] INFO Main - arg 1 = Automic1
21:45:36.218 [main] INFO Main - arg 2 = jdbc:oracle:thin:@//lvntest021348:1521/orclpdb
21:45:36.868 [main] INFO Main - ****** Starting JDBC Connection test *******
21:45:37.381 [main] INFO Main - Running SQL query: [select sysdate from dual]
21:45:37.409 [main] INFO Main - Result of SQL query: [2021-08-04 21:45:37.0]
21:45:37.411 [main] INFO Main - JDBC connection test successful!

Test result for wrong Oracle port:

[[email protected] bin]$ java -jar jdbc-tester-1.1.jar Automic Automic1 jdbc:oracle:thin:@//lvntest021348:1544/orclpdb
21:45:43.825 [main] INFO Main - arg 0 = Automic
21:45:43.831 [main] INFO Main - arg 1 = Automic1
21:45:43.831 [main] INFO Main - arg 2 = jdbc:oracle:thin:@//lvntest021348:1544/orclpdb
21:45:44.015 [main] INFO Main - ****** Starting JDBC Connection test *******
21:45:44.129 [main] ERROR Main - Exception occurred connecting to database: IO Error: The Network Adapter could not establish the connection

Test result for wrong database name:

[[email protected] bin]$ java -jar jdbc-tester-1.1.jar Automic Automic1 jdbc:oracle:thin:@//lvntest021348:1521/orclpdber
22:00:32.001 [main] INFO Main - arg 0 = Automic
22:00:32.007 [main] INFO Main - arg 1 = Automic1
22:00:32.008 [main] INFO Main - arg 2 = jdbc:oracle:thin:@//lvntest021348:1521/orclpdber
22:00:32.221 [main] INFO Main - ****** Starting JDBC Connection test *******
22:00:32.388 [main] ERROR Main - Exception occurred connecting to database: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

Test result for wrong host:

[[email protected] bin]$ java -jar jdbc-tester-1.1.jar Automic Automic1 jdbc:oracle:thin:@//lvntest02134812:1544/orclpdb
23:28:05.993 [main] INFO Main - arg 0 = Automic
23:28:06.001 [main] INFO Main - arg 1 = Automic1
23:28:06.001 [main] INFO Main - arg 2 = jdbc:oracle:thin:@//lvntest02134812:1544/orclpdb
23:28:06.223 [main] INFO Main - ****** Starting JDBC Connection test *******
23:28:06.519 [main] ERROR Main - Exception occurred connecting to database: IO Error: Unknown host specified

Attachments

jdbc-tester-1.1_1628119318800.jar get_app