Package com.version1.DataBaseManagement
Class DatabaseHelper
java.lang.Object
com.version1.DataBaseManagement.DatabaseHelper
Database helper utility class providing support methods for DataBase connection
and executing the queries
JDBC configuration is fetched from config.json
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecuteQuery(String sqlQuery) Executed the Query to the databaseprotected org.apache.commons.dbutils.QueryRunnerCreates the instance of the QuerryRunner class QuerryRunner class executes SQL queries with pluggable strategies for handling ResultSetsprotected static ConnectionSteps up the connection to the database using the jdbc configurations
-
Field Details
-
conn
-
DBConfig
-
-
Constructor Details
-
DatabaseHelper
public DatabaseHelper()
-
-
Method Details
-
setUpConnection
Steps up the connection to the database using the jdbc configurations -
executeQuery
Executed the Query to the database- Parameters:
sqlQuery- to be executed in the database- Returns:
- List of values returned by the executed Query
- Throws:
SQLException
-
getQueryRunner
protected org.apache.commons.dbutils.QueryRunner getQueryRunner()Creates the instance of the QuerryRunner class QuerryRunner class executes SQL queries with pluggable strategies for handling ResultSets- Returns:
- QueryRunner the instance of the QueryRunner class
-