public class ConnectionHolder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACCESS_NOT_SET_YET |
static int |
DB2_400 |
static int |
DBASE |
static int |
DERBY |
static int |
FIREBIRD |
static int |
JAVA_DB_ACCESS |
static int |
MARIA_DB |
static int |
MS_ACCESS |
static int |
MS_SQL_SERVER |
static int |
MYSQL |
static int |
ODBC_ACCESS |
static int |
ODBC_ACCESS_BY_MDB_FILE_NAME |
static int |
ORACLE |
static int |
OTHER_ACCESS |
static int |
POSTGRESQL |
static int |
SQLBASE |
static int |
SQLITE |
static int |
U_CAN_ACCESS |
Constructor and Description |
---|
ConnectionHolder(ConnectionSpecification connectionSpecification)
Constructs a new connection holder.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkAndReactivateDbConnIfNecessary()
Checks the connection and reactivates it, if the connection is broken.
|
void |
closeConnection()
Closes the current connection.
|
java.sql.Connection |
createConnection()
Creates and returns the connection based on the previously set connection specification.
|
java.sql.Connection |
createConnection(ConnectionSpecification connectionSpecification) |
SqlDialect |
createSqlDialect()
Returns a new instance of the SQL dialect supporting class of the database
|
static SqlDialect |
createSqlDialect(java.sql.Connection connection)
Returns a new instance of the SQL dialect supporting class of the database
as found in the specified connection.
|
static SqlDialect |
createSqlDialect(int databaseType) |
protected void |
finalize() |
java.sql.Connection |
getConnection()
Returns the connection.
|
ConnectionSpecification |
getConnectionSpecification()
Returns the used connection specification.
|
int |
getDatabaseType()
Returns the database type of the current connection.
|
static int |
getDatabaseType(java.sql.Connection connection)
Returns the database type of the specified connection.
|
static java.lang.String |
getLastCreateExceptionDescription()
Returns the description if the last create exception.
|
long |
getLockTime() |
boolean |
hasOrHad(java.sql.Connection connection)
Returns true if connection holder holds this connection or has been the holder of the specified connection.
|
boolean |
isConnected()
Returns true if the connection holder is connected.
|
boolean |
isConnectionBroken()
Returns true if the connection is broken.
|
boolean |
isVacant()
Returns true if the hold connection is vacant to be reused as private
connection of another owner.
|
void |
lock()
Locks the connection as privately use.
|
void |
unlock()
Unlocks the connection as privately use.
|
public static final int ACCESS_NOT_SET_YET
public static final int ODBC_ACCESS
public static final int ODBC_ACCESS_BY_MDB_FILE_NAME
public static final int OTHER_ACCESS
public static final int JAVA_DB_ACCESS
public static final int MS_ACCESS
public static final int DBASE
public static final int ORACLE
public static final int MYSQL
public static final int DB2_400
public static final int MS_SQL_SERVER
public static final int SQLITE
public static final int SQLBASE
public static final int POSTGRESQL
public static final int DERBY
public static final int U_CAN_ACCESS
public static final int MARIA_DB
public static final int FIREBIRD
public ConnectionHolder(ConnectionSpecification connectionSpecification)
public ConnectionSpecification getConnectionSpecification()
public java.sql.Connection createConnection() throws java.lang.ClassNotFoundException, java.sql.SQLException
java.lang.ClassNotFoundException
java.sql.SQLException
public java.sql.Connection createConnection(ConnectionSpecification connectionSpecification) throws java.lang.ClassNotFoundException, java.sql.SQLException
java.lang.ClassNotFoundException
java.sql.SQLException
public void closeConnection()
public boolean isConnected()
public java.sql.Connection getConnection()
public static java.lang.String getLastCreateExceptionDescription()
public int getDatabaseType()
public SqlDialect createSqlDialect()
public static SqlDialect createSqlDialect(java.sql.Connection connection)
connection
- the connection to check out the database typepublic static SqlDialect createSqlDialect(int databaseType)
public static int getDatabaseType(java.sql.Connection connection)
connection
- the connection to checkpublic boolean isVacant()
public void lock()
public void unlock()
public long getLockTime()
public boolean hasOrHad(java.sql.Connection connection)
connection
- the connection to checkpublic boolean checkAndReactivateDbConnIfNecessary()
public boolean isConnectionBroken()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de