Package javatapas.sql
Class GetDatabaseConnection
java.lang.Object
javatapas.sql.GetDatabaseConnection
public class GetDatabaseConnection extends Object
Return an active JDBC Connection Object.
Published at https://www.javatapas.com/sql/Java-Get-Database-Connection.html
Javadoc at https://www.javatapas.com/docs/javatapas/sql/GetDatabaseConnection.html
Published at https://www.javatapas.com/sql/Java-Get-Database-Connection.html
Javadoc at https://www.javatapas.com/docs/javatapas/sql/GetDatabaseConnection.html
- Version:
- 2021-05-24
- Author:
- Kodiak Brown
-
Constructor Summary
Constructors Constructor Description GetDatabaseConnection()
-
Method Summary
-
Constructor Details
-
GetDatabaseConnection
public GetDatabaseConnection()
-
-
Method Details
-
getDatabaseConnection
public static Connection getDatabaseConnection(String dbDriver, String dbPreface, String dbHostName, String dbPort, String dbSchemaName, String dbParams, String dbUser, String dbPassword, String dbLoginTimeout) throws SQLException, ClassNotFoundException- Parameters:
dbDriver
- The class name of the JDBC driver. E.g. org.hsqldb.jdbcDriver, oracle.jdbc.driver.OracleDriver, com.mysql.jdbc.Driver, etc.dbPreface
- The JDBC url connection preface. E.g. hsqldb:hsql, oracle:thin, mysql, etc.dbHostName
- The server DNS name that the database is hosted from. Can also be an IP address.dbPort
- The port name that the database platform is hosting through.dbSchemaName
- The database name.dbParams
- Any additional parameters required for the connection. Each dbParam must be prefaced by a semicolon. E.g. ;sql.enforce_strict_size=truedbUser
- The user name for the connection.dbPassword
- The user's password.dbLoginTimeout
- The maximum time in seconds that a driver can wait when attempting to log in to a database.- Throws:
SQLException
ClassNotFoundException
-