DataBridge Documentation 2.0.17
A Java library for managing database connections and transactions
|
Public Member Functions | |
void | close () |
void | connect (String url, String username, String password) throws SQLException |
boolean | execute (String query) throws SQLException |
ResultSet | executeQuery (String query) throws SQLException |
int | executeUpdate (String query) throws SQLException |
Connection | get () |
Public Member Functions inherited from io.github.kdesp73.databridge.connections.DatabaseConnection |
The MSAccessConnection
class implements the DatabaseConnection
interface for connecting to and interacting with a Microsoft Access database using the UCanAccess JDBC driver.
This class provides methods to establish a connection to the database, execute SQL queries (both SELECT and UPDATE), handle DDL operations, and close the connection.
The connection to the database is established using the UCanAccess JDBC driver, which requires the driver to be present in the classpath. The connection string must follow the format jdbc:ucanaccess://path_to_database
.
Connection io.github.kdesp73.databridge.connections.MSAccessConnection.get | ( | ) |
Returns the underlying Connection
object for the MS Access database.
Connection
instance for the database connection. Implements io.github.kdesp73.databridge.connections.DatabaseConnection.
void io.github.kdesp73.databridge.connections.MSAccessConnection.connect | ( | String | url, |
String | username, | ||
String | password ) throws SQLException |
Establishes a connection to the MS Access database.
The connection URL must begin with jdbc:ucanaccess://
, followed by the path to the database file. If the URL does not start with this prefix, it will be automatically added.
url | the database URL in the format jdbc:ucanaccess://path_to_database . |
username | the username for database access (not used by MS Access, but required for the interface). |
password | the password for database access (not used by MS Access, but required for the interface). |
SQLException | if the connection to the database fails. |
Implements io.github.kdesp73.databridge.connections.DatabaseConnection.
int io.github.kdesp73.databridge.connections.MSAccessConnection.executeUpdate | ( | String | query | ) | throws SQLException |
Executes an UPDATE SQL query (INSERT, UPDATE, DELETE) on the MS Access database.
This method attempts the query execution with retries in case of failure, using the Again
helper.
query | the SQL query string to execute. |
SQLException | if a database access error occurs or if the query is invalid. |
Implements io.github.kdesp73.databridge.connections.DatabaseConnection.
ResultSet io.github.kdesp73.databridge.connections.MSAccessConnection.executeQuery | ( | String | query | ) | throws SQLException |
Executes a SELECT SQL query and returns the result as a ResultSet
.
This method attempts the query execution with retries in case of failure, using the Again
helper.
query | the SQL SELECT query string to execute. |
ResultSet
containing the result of the query. SQLException | if a database access error occurs or if the query is invalid. |
Implements io.github.kdesp73.databridge.connections.DatabaseConnection.
boolean io.github.kdesp73.databridge.connections.MSAccessConnection.execute | ( | String | query | ) | throws SQLException |
Executes a DDL SQL query (e.g., CREATE, ALTER, DROP) on the MS Access database.
This method attempts the query execution with retries in case of failure, using the Again
helper.
query | the SQL DDL query string to execute. |
true
if the query executed successfully, false
otherwise. SQLException | if a database access error occurs or if the query is invalid. |
Implements io.github.kdesp73.databridge.connections.DatabaseConnection.
void io.github.kdesp73.databridge.connections.MSAccessConnection.close | ( | ) |
Closes the database connection, releasing any resources.
If the connection is already null
or closed, this method does nothing.
Implements io.github.kdesp73.databridge.connections.DatabaseConnection.