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
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.
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.