public abstract class JDBCConnector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected long |
connectionId
Connection ID
|
protected java.sql.Connection |
connector
Connection object
|
protected java.lang.String |
jdbcString
JDBC Connection String
|
Modifier | Constructor and Description |
---|---|
|
JDBCConnector(java.sql.Connection connector)
JDBC Constructor
|
protected |
JDBCConnector(java.lang.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(java.sql.PreparedStatement preparedRequest)
Function to execute prepared query
|
int |
executeQuery(java.lang.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
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Prepare a request
|
java.sql.ResultSet |
query(java.lang.String sql)
Function to query SQL request
|
java.sql.ResultSet |
queryPreparedStatement(java.sql.PreparedStatement preparedRequest)
Query a prepared request
|
void |
rollback()
Rollback the transaction
|
void |
setAutoCommit(boolean isAutoCommit)
Set auto commit value
|
protected java.sql.Connection connector
protected java.lang.String jdbcString
protected long connectionId
protected JDBCConnector(java.lang.String jdbcString)
jdbcString
- JDBC Stringpublic JDBCConnector(java.sql.Connection connector)
connector
- Connectorpublic boolean isOpen() throws java.sql.SQLException
java.sql.SQLException
- SQL Exceptionpublic void open() throws java.sql.SQLException
java.sql.SQLException
- SQL Exceptionpublic void close() throws java.sql.SQLException
java.sql.SQLException
- SQL Exceptionpublic int executeQuery(java.lang.String sql) throws java.sql.SQLException
sql
- Request to execute (without protection)java.sql.SQLException
- SQL Exceptionpublic int executePreparedQuery(java.sql.PreparedStatement preparedRequest) throws java.sql.SQLException
preparedRequest
- SQL request to executejava.sql.SQLException
- SQL Exceptionpublic java.sql.ResultSet query(java.lang.String sql) throws java.sql.SQLException
sql
- SQL request to execute (without protection)java.sql.SQLException
- SQL Exceptionpublic java.sql.ResultSet queryPreparedStatement(java.sql.PreparedStatement preparedRequest) throws java.sql.SQLException
preparedRequest
- Prepared Requestjava.sql.SQLException
- SQL Exceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
sql
- SQL request to preparejava.sql.SQLException
- SQL Exceptionpublic void setAutoCommit(boolean isAutoCommit) throws java.sql.SQLException
isAutoCommit
- Boolean indicating expected auto commit valuejava.sql.SQLException
- SQL Exceptionpublic boolean isAutoCommit() throws java.sql.SQLException
java.sql.SQLException
- SQL Exceptionpublic void commit() throws java.sql.SQLException
java.sql.SQLException
- SQL Exceptionpublic void rollback() throws java.sql.SQLException
java.sql.SQLException
- SQL Exception