public abstract class JDBCConnector extends Object
| Modifier and Type | Field and Description |
|---|---|
protected long |
connectionId
Connection ID
|
protected Connection |
connector
Connection object
|
protected String |
jdbcString
JDBC Connection String
|
| Modifier | Constructor and Description |
|---|---|
|
JDBCConnector(Connection connector)
JDBC Constructor
|
protected |
JDBCConnector(String jdbcString)
JDBC Connection constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close connection to the database
|
void |
commit()
Commit the transaction
|
int |
executePreparedQuery(PreparedStatement preparedRequest)
Function to execute prepared query
|
int |
executeQuery(String sql)
Function to launch SQL request
|
boolean |
isAutoCommit()
Get auto commit value
|
boolean |
isOpen()
Function which check if the connection is opened
|
void |
open()
Open connection to the database
|
PreparedStatement |
prepareStatement(String sql)
Prepare a request
|
ResultSet |
query(String sql)
Function to query SQL request
|
ResultSet |
queryPreparedStatement(PreparedStatement preparedRequest)
Query a prepared request
|
void |
rollback()
Rollback the transaction
|
void |
setAutoCommit(boolean isAutoCommit)
Set auto commit value
|
protected Connection connector
protected String jdbcString
protected long connectionId
protected JDBCConnector(String jdbcString)
jdbcString - JDBC Stringpublic JDBCConnector(Connection connector)
connector - Connectorpublic boolean isOpen()
throws SQLException
SQLException - SQL Exceptionpublic void open()
throws SQLException
SQLException - SQL Exceptionpublic void close()
throws SQLException
SQLException - SQL Exceptionpublic int executeQuery(String sql) throws SQLException
sql - Request to execute (without protection)SQLException - SQL Exceptionpublic int executePreparedQuery(PreparedStatement preparedRequest) throws SQLException
preparedRequest - SQL request to executeSQLException - SQL Exceptionpublic ResultSet query(String sql) throws SQLException
sql - SQL request to execute (without protection)SQLException - SQL Exceptionpublic ResultSet queryPreparedStatement(PreparedStatement preparedRequest) throws SQLException
preparedRequest - Prepared RequestSQLException - SQL Exceptionpublic PreparedStatement prepareStatement(String sql) throws SQLException
sql - SQL request to prepareSQLException - SQL Exceptionpublic void setAutoCommit(boolean isAutoCommit)
throws SQLException
isAutoCommit - Boolean indicating expected auto commit valueSQLException - SQL Exceptionpublic boolean isAutoCommit()
throws SQLException
SQLException - SQL Exceptionpublic void commit()
throws SQLException
SQLException - SQL Exceptionpublic void rollback()
throws SQLException
SQLException - SQL ExceptionCopyright © 2016. All rights reserved.