
public class DbSession extends Object
| Constructor and Description |
|---|
DbSession(DbAdmin admin,
boolean isReadOnly)
Create a session and connect the current object to the server using the DbAdmin object.
|
DbSession(DbAdmin admin,
boolean isReadOnly,
boolean autoCommit)
Create a session and connect the current object to the server using the DbAdmin object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLongTermPreparedStatement(DbPreparedStatement longterm)
Add a Long Term PreparedStatement
|
void |
checkConnection()
Check the connection to the Database and try to reopen it if possible
|
boolean |
checkConnectionNoException() |
void |
commit()
Commit everything
|
void |
disconnect()
Close the connection
|
void |
endUseConnection()
To be called when a client will stop to use this DbSession (once by client)
|
void |
enUseConnectionNoDisconnect()
To be called when a client will stop to use this DbSession (once by client).
|
boolean |
equals(Object o) |
static void |
error(SQLException ex)
Print the error from SQLException
|
void |
forceDisconnect()
Force the close of the connection
|
DbAdmin |
getAdmin() |
Connection |
getConn() |
UUID |
getInternalId() |
int |
hashCode() |
boolean |
isAutoCommit() |
boolean |
isDisActive() |
boolean |
isReadOnly() |
void |
recreateLongTermPreparedStatements()
Due to a reconnection, recreate all associated long term PreparedStatements
|
void |
releaseSavepoint(Savepoint savepoint)
Release the savepoint
|
void |
removeLongTermPreparedStatements()
Remove all Long Term PreparedStatements (closing connection)
|
void |
removeLongTermPreparedStatements(DbPreparedStatement longterm)
Remove one Long Term PreparedStatement
|
void |
rollback(Savepoint savepoint)
Rollback from the savepoint or the last set if null
|
Savepoint |
savepoint()
Make a savepoint
|
protected void |
setAdmin(DbAdmin admin) |
void |
setAutoCommit(boolean autoCommit)
Change the autocommit feature
|
void |
setConn(Connection conn) |
void |
setDisActive(boolean isDisActive) |
void |
setReadOnly(boolean isReadOnly) |
void |
useConnection()
To be called when a client will start to use this DbSession (once by client)
|
public DbSession(DbAdmin admin, boolean isReadOnly) throws WaarpDatabaseNoConnectionException
admin - isReadOnly - WaarpDatabaseSqlExceptionWaarpDatabaseNoConnectionExceptionpublic DbSession(DbAdmin admin, boolean isReadOnly, boolean autoCommit) throws WaarpDatabaseNoConnectionException
admin - isReadOnly - autoCommit - WaarpDatabaseSqlExceptionWaarpDatabaseNoConnectionExceptionpublic void setAutoCommit(boolean autoCommit)
throws WaarpDatabaseNoConnectionException
autoCommit - WaarpDatabaseNoConnectionExceptionpublic DbAdmin getAdmin()
protected void setAdmin(DbAdmin admin)
admin - the admin to setpublic static void error(SQLException ex)
ex - public void useConnection()
public void endUseConnection()
public void enUseConnectionNoDisconnect()
public void forceDisconnect()
public void disconnect()
public void checkConnection()
throws WaarpDatabaseNoConnectionException
public boolean checkConnectionNoException()
public void addLongTermPreparedStatement(DbPreparedStatement longterm)
longterm - public void recreateLongTermPreparedStatements()
throws WaarpDatabaseNoConnectionException,
WaarpDatabaseSqlException
public void removeLongTermPreparedStatements()
public void removeLongTermPreparedStatements(DbPreparedStatement longterm)
longterm - public void commit()
throws WaarpDatabaseSqlException,
WaarpDatabaseNoConnectionException
public void rollback(Savepoint savepoint) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
savepoint - WaarpDatabaseNoConnectionExceptionWaarpDatabaseSqlExceptionpublic Savepoint savepoint() throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
WaarpDatabaseNoConnectionExceptionWaarpDatabaseSqlExceptionpublic void releaseSavepoint(Savepoint savepoint) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
savepoint - WaarpDatabaseNoConnectionExceptionWaarpDatabaseSqlExceptionpublic boolean isReadOnly()
public void setReadOnly(boolean isReadOnly)
isReadOnly - the isReadOnly to setpublic boolean isAutoCommit()
public Connection getConn()
public void setConn(Connection conn)
conn - the conn to setpublic UUID getInternalId()
public boolean isDisActive()
public void setDisActive(boolean isDisActive)
isDisActive - the isDisActive to setCopyright © 2009–2019 Waarp. All rights reserved.