DataBridge Documentation 2.0.17
A Java library for managing database connections and transactions
Loading...
Searching...
No Matches
io.github.kdesp73.databridge.connections.AvailableConnections Enum Reference

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)
 

Detailed Description

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.
Author
KDesp73

Constructor & Destructor Documentation

◆ AvailableConnections()

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.

Parameters
clazzThe class of the database connection to instantiate.

Member Function Documentation

◆ getConnection()

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.

Returns
A DatabaseConnection instance configured and connected to the database.
Exceptions
SQLExceptionIf there is an error establishing the database connection.
UnsupportedOperationExceptionIf the configuration properties are not properly set up.

◆ toString()

String io.github.kdesp73.databridge.connections.AvailableConnections.toString ( )

Returns the name of the enum constant as a string.

Returns
The name of the enum constant.

Member Data Documentation

◆ SQLITE

io.github.kdesp73.databridge.connections.AvailableConnections.SQLITE =(SQLiteConnection.class)

SQLite connection type.

◆ POSTGRES

io.github.kdesp73.databridge.connections.AvailableConnections.POSTGRES =(PostgresConnection.class)

PostgreSQL connection type.

◆ MSACCESS

io.github.kdesp73.databridge.connections.AvailableConnections.MSACCESS =(MSAccessConnection.class)

MS Access connection type.


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