DataBridge Documentation 2.0.17
A Java library for managing database connections and transactions
Loading...
Searching...
No Matches
io.github.kdesp73.databridge.connections.MSAccessConnection Class Reference
Inheritance diagram for io.github.kdesp73.databridge.connections.MSAccessConnection:
io.github.kdesp73.databridge.connections.DatabaseConnection AutoCloseable

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

Detailed Description

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.

Author
KDesp73

Member Function Documentation

◆ get()

Connection io.github.kdesp73.databridge.connections.MSAccessConnection.get ( )

Returns the underlying Connection object for the MS Access database.

Returns
the Connection instance for the database connection.

Implements io.github.kdesp73.databridge.connections.DatabaseConnection.

◆ connect()

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.

Parameters
urlthe database URL in the format jdbc:ucanaccess://path_to_database.
usernamethe username for database access (not used by MS Access, but required for the interface).
passwordthe password for database access (not used by MS Access, but required for the interface).
Exceptions
SQLExceptionif the connection to the database fails.

Implements io.github.kdesp73.databridge.connections.DatabaseConnection.

◆ executeUpdate()

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.

Parameters
querythe SQL query string to execute.
Returns
the number of rows affected by the query.
Exceptions
SQLExceptionif a database access error occurs or if the query is invalid.

Implements io.github.kdesp73.databridge.connections.DatabaseConnection.

◆ executeQuery()

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.

Parameters
querythe SQL SELECT query string to execute.
Returns
a ResultSet containing the result of the query.
Exceptions
SQLExceptionif a database access error occurs or if the query is invalid.

Implements io.github.kdesp73.databridge.connections.DatabaseConnection.

◆ execute()

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.

Parameters
querythe SQL DDL query string to execute.
Returns
true if the query executed successfully, false otherwise.
Exceptions
SQLExceptionif a database access error occurs or if the query is invalid.

Implements io.github.kdesp73.databridge.connections.DatabaseConnection.

◆ close()

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.


The documentation for this class was generated from the following file: