Class DatabaseConnectionFactory
java.lang.Object
com.mirth.connect.server.userutil.DatabaseConnectionFactory
Used to create database connection objects.
-
Constructor Summary
ConstructorsConstructorDescriptionDatabaseConnectionFactory(com.mirth.connect.server.util.javascript.MirthContextFactory contextFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateConnection(String driver, String address, String username, String password) Instantiates and returns a new java.sql.Connection object with the given connection parameters.createDatabaseConnection(String driver, String address) Instantiates and returns a new DatabaseConnection object with the given connection parameters.createDatabaseConnection(String driver, String address, String username, String password) Instantiates and returns a new DatabaseConnection object with the given connection parameters.voidinitializeDriver(String driver) Initializes the specified JDBC driver.
-
Constructor Details
-
DatabaseConnectionFactory
public DatabaseConnectionFactory(com.mirth.connect.server.util.javascript.MirthContextFactory contextFactory)
-
-
Method Details
-
createDatabaseConnection
public DatabaseConnection createDatabaseConnection(String driver, String address, String username, String password) throws SQLException Instantiates and returns a new DatabaseConnection object with the given connection parameters.- Parameters:
driver- The JDBC driver class (as a string) to use to create the connection with.address- The server address to connect to.username- The username to connect with.password- The password to connect with.- Returns:
- The created DatabaseConnection object.
- Throws:
SQLException- If a database access error occurs.
-
createDatabaseConnection
public DatabaseConnection createDatabaseConnection(String driver, String address) throws SQLException Instantiates and returns a new DatabaseConnection object with the given connection parameters.- Parameters:
driver- The JDBC driver class (as a string) to use to create the connection with.address- The server address to connect to.- Returns:
- The created DatabaseConnection object.
- Throws:
SQLException- If a database access error occurs.
-
createConnection
public Connection createConnection(String driver, String address, String username, String password) throws SQLException Instantiates and returns a new java.sql.Connection object with the given connection parameters.- Parameters:
driver- The JDBC driver class (as a string) to use to create the connection with.address- The server address to connect to.username- The username to connect with.password- The password to connect with.- Returns:
- The created DatabaseConnection object.
- Throws:
SQLException- If a database access error occurs.
-
initializeDriver
Initializes the specified JDBC driver. This can be used in JavaScript contexts where "Class.forName" can't be called directly.- Parameters:
driver- The JDBC driver class (as a string) to initialize.- Throws:
Exception- If the driver could not be initialized.
-