public class Database
extends java.lang.Object
Constructor and Description |
---|
Database() |
Modifier and Type | Method and Description |
---|---|
static void |
close(java.sql.Connection connection,
java.sql.PreparedStatement preparedStatement,
java.sql.ResultSet resultSet)
Static method for closing connection, preparedStatement, and resultSet
|
java.sql.Connection |
connect()
connect() using private method isJUnitTest(),
that checks if connection is established through unit testing or production,
and selects database accordingly
|
static boolean |
isJUnitTest()
Method for checking if we are connecting to test database or production database
Using test database properties if className type is JUnit
|
public static boolean isJUnitTest()
public java.sql.Connection connect()
public static void close(java.sql.Connection connection, java.sql.PreparedStatement preparedStatement, java.sql.ResultSet resultSet)
connection
- ConnectionpreparedStatement
- PreparedStatementresultSet
- ResultSet