|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kotkabeans.DB
provides a connection to the Kotka database to the other beans.
Field Summary | |
protected java.text.DateFormat |
df
Field is used to format timestamp output to log-file. |
protected java.sql.Connection |
myconn
Stores used database connection. |
protected java.sql.Statement |
stmt
Used to carry out database operations. |
protected boolean |
transaction
Set to true if transaction has been started. |
Constructor Summary | |
DB()
|
Method Summary | |
void |
abortTransaction()
Flushes transaction-buffer without executing commands. |
void |
beginTransaction()
Starts collecting SQL-commands to buffer, which are executed later as a single block. |
void |
connect()
Requests connection to the Kotka-database. |
void |
disconnect()
Releases used connection. |
void |
endTransaction()
Executes SQL-commands from buffer created by beginTransaction() -method. |
java.sql.ResultSet |
executeQuery(java.lang.String sqlSentence)
Executes SQL-query and establishes connection if needed. |
int |
executeUpdate(java.lang.String sqlSentence)
Executes SQL-update and registeres it to the log file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.sql.Connection myconn
null, connect()
-method
is called when one tries to use database-oriented methods.connect()
protected java.sql.Statement stmt
connect()
-method.connect()
protected java.text.DateFormat df
protected boolean transaction
true
if transaction has been started. Othervise false
Constructor Detail |
public DB()
Method Detail |
public void connect() throws java.lang.Exception
public void disconnect() throws java.lang.Exception
public java.sql.ResultSet executeQuery(java.lang.String sqlSentence) throws java.lang.Exception
sqlSentence
- SQL-query to executepublic int executeUpdate(java.lang.String sqlSentence) throws java.lang.Exception
sqlSentence
- SQL-update to executepublic void beginTransaction() throws java.lang.Exception
public void endTransaction() throws java.lang.Exception
beginTransaction()
-method.
If there is no active transaction, method does nothing.beginTransaction()
public void abortTransaction() throws java.lang.Exception
beginTransaction()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |