A simple command line application to test JDBC connection to Oracle Database.
Clone this repository and then run below Maven command to build the executable JAR file.
mvn clean package
Alternatively, download the JAR file from release page.
Execute the JAR file with the following 3 parameters with schema name, password and JDBC connection string:
java -jar target/jdbc-tester-1.1.jar <schema_name> <schema_password> jdbc:oracle:thin:@//<host>:<port>/<SID>
When running this tool ad-hoc, a good security practice would be read the DB username and password into a variable by using read
command in Linux (or similar) and then execute the JAR file.
This prevents DB credentials being stored in ~/.bash_history
.
java -jar target/jdbc-tester-1.1.jar "$DB_USER" "$DB_PASS" jdbc:oracle:thin:@//<host>:<port>/<SID>
The application connects to the Oracle database and executes a single SQL query: select sysdate from dual
and prints the output.
If it cannot connect for whatever reason, it will fail by logging an error message.
There is a hardcoded connection timeout set to 10 seconds.
(The MIT License)
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.