|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.xbus.technical.database.DBConnection
public class DBConnection
DBConnection manages connections to databases.
It implements two Design-Patterns:
DBConnection is created
for every thread. This instance can be fetched with
getInstance().
| Field Summary | |
|---|---|
static java.lang.String |
UNNAMED
|
| Method Summary | |
|---|---|
void |
bind(java.lang.Object name,
int pos,
int value)
Binds an integer value to a parameter in a stored prepared statement. |
void |
bind(java.lang.Object name,
int pos,
java.lang.String value)
Binds a string value to a parameter in a stored prepared statement. |
void |
bindNull(java.lang.Object name,
int pos,
int type)
Binds a null value to a parameter in a stored prepared statement. |
static void |
clear()
|
void |
close()
Closes a resource. |
void |
commit()
Commits all actions on the database. |
java.sql.ResultSet |
executeRead(java.lang.String statement)
Executes a SQL statement to read data. |
java.sql.ResultSet |
executeReadPrepared(java.lang.Object name)
Executes a stored prepared statement. |
int |
executeUpdate(java.lang.String statement)
Executes an update, insert or delete statement. |
int |
executeUpdatePrepared(java.lang.Object name)
Executes a stored prepared statement. |
boolean |
existsPrepared(java.lang.Object name)
Tests if a prepared statement is stored. |
static DBConnection |
getInstance(java.lang.String name)
Delivers an instance of DBConnection. |
java.lang.String |
getUrl()
Returns the complete URL of the DBConnection |
void |
open()
Opens the connection to the database. |
void |
prepareStatement(java.lang.Object name,
java.lang.String statement)
Stores the given SQL statement as a prepared statement under the given name. |
void |
reopen()
Reopens a database connection after an error has been detected. |
void |
rollback()
Performs a rollback for all actions on the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String UNNAMED
| Method Detail |
|---|
public static DBConnection getInstance(java.lang.String name)
throws XException
DBConnection.
If it is the first call for the actual thread, a new
DBConnection -object gets created. Subsequent calls in
this thread will deliver the object, that has been created by the first
call.
XException
public void open()
throws XException
open in interface TAResourceXException - if something goes wrong
public void close()
throws XException
TAResource
close in interface TAResourceXException - if something goes wrong
public void commit()
throws XException
commit in interface TAResourceXException - if something goes wrong
public void rollback()
throws XException
rollback in interface TAResourceXException - if something goes wrong
public void reopen()
throws XException
XException
public java.sql.ResultSet executeRead(java.lang.String statement)
throws XException
statement - SQL statement to read data
XException - if something goes wrong
public int executeUpdate(java.lang.String statement)
throws XException
statement - SQL statement to update, insert or delete rows
XException - if something goes wrong
public void prepareStatement(java.lang.Object name,
java.lang.String statement)
throws XException
XException
public void bind(java.lang.Object name,
int pos,
java.lang.String value)
throws XException
name - the name under which the prepared statement is storedpos - position of the parameter in the prepared statementvalue - value that will be bound to the parameter
XException
public void bind(java.lang.Object name,
int pos,
int value)
throws XException
name - the name under which the prepared statement is storedpos - position of the parameter in the prepared statementvalue - value that will be bound to the parameter
XException
public void bindNull(java.lang.Object name,
int pos,
int type)
throws XException
name - the name under which the prepared statement is storedpos - position of the parameter in the prepared statementtype - the type of the column (see java.sql.Types)
XException
public int executeUpdatePrepared(java.lang.Object name)
throws XException
name - the name under which the prepared statement is stored
XException
public java.sql.ResultSet executeReadPrepared(java.lang.Object name)
throws XException
name - the name under which the prepared statement is stored
XExceptionpublic boolean existsPrepared(java.lang.Object name)
name - the name under which the prepared statement is stored
public static void clear()
public java.lang.String getUrl()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||