DataBridge Documentation 2.0.17
A Java library for managing database connections and transactions
|
Public Member Functions | |
AvailableConnections (Class<? extends DatabaseConnection > clazz) | |
DatabaseConnection | getConnection () throws SQLException |
String | toString () |
Public Attributes | |
MSACCESS =(MSAccessConnection.class) | |
POSTGRES =(PostgresConnection.class) | |
SQLITE =(SQLiteConnection.class) | |
The AvailableConnections
enum defines the supported database connections (SQLITE, POSTGRES, MSACCESS) and provides a method to retrieve a database connection instance based on the selected type.
Each enum constant corresponds to a specific database connection implementation, and upon initialization, it tries to instantiate the associated connection class using reflection.
The getConnection()
method retrieves a configured connection instance, ensuring that the necessary configuration properties are available before establishing a connection.
The supported connection types are:
SQLITE
- SQLite database connection. POSTGRES
- PostgreSQL database connection. MSACCESS
- MS Access database connection. io.github.kdesp73.databridge.connections.AvailableConnections.AvailableConnections | ( | Class<? extends DatabaseConnection > | clazz | ) |
Constructs an AvailableConnections
enum constant and tries to instantiate the corresponding connection class via reflection.
clazz | The class of the database connection to instantiate. |
DatabaseConnection io.github.kdesp73.databridge.connections.AvailableConnections.getConnection | ( | ) | throws SQLException |
Returns a configured database connection instance based on the configuration properties.
This method will attempt to connect using the URL, user, and password from the Config
class. If no valid configuration is found, an exception is thrown.
DatabaseConnection
instance configured and connected to the database. SQLException | If there is an error establishing the database connection. |
UnsupportedOperationException | If the configuration properties are not properly set up. |
String io.github.kdesp73.databridge.connections.AvailableConnections.toString | ( | ) |
Returns the name of the enum constant as a string.
io.github.kdesp73.databridge.connections.AvailableConnections.SQLITE =(SQLiteConnection.class) |
SQLite connection type.
io.github.kdesp73.databridge.connections.AvailableConnections.POSTGRES =(PostgresConnection.class) |
PostgreSQL connection type.
io.github.kdesp73.databridge.connections.AvailableConnections.MSACCESS =(MSAccessConnection.class) |
MS Access connection type.