Oracle JDBC Connection Tester

From time to time, when working at various sites I have to check connections to a database.  If you have been an Oracle DBA for some time, you already know that the listener has to be up and services have to be registered before you can connect from a remote host.  If the listener is up and services are registered, then you should be able to get to the database; so why the need for a connection tester?

Recently, I’ve been asked to verify connections for a few databases to provide management a “warm-and-fuzzy” about their connections to environments; also helps in troubleshooting if you know the service name.  I have been asked to verify connections more than once in my career and always wanted a simple way that I could test without logging into the database host or needing to use an Oracle client.  Hence the reason I wrote this simple JDBC connection tool.

This tool is simple to use, it takes the following to build the URL for connection to Oracle:

  • Hostname/IP Address
  • Listener Port
  • SID/Service Name
  • Username
  • Password

Note: The password will be passed in clear text!

Once the requirements for the URL are provided, the tool attempts to login to the database with the username and password provided.  If the listener and services are working correctly, the tool will return a successful message.  If not, the tool will provide an error stack with the reason why it failed to connect.

I am making the tool available here if you would like to test or use it.   

In order to run the tool, it will need to be ran from the command prompt and Java should be in your path.  The tool was written against JDK 1.7 and uses the ojdbc6.jar which is provided with Oracle 11g.  Also, the ojdbc6.jar file is provided in the lib directory after unzipping the tool.  The README.txt file that comes with the tool explains how to run the tool.

Here is a screenshot of a run done previously.

image

Enjoy!

twitter: @dbasolved

blog: http://dbasolved.com

Please follow and like:
Comments
Comments are closed.

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.