jora
Class Session
java.lang.Object
|
+--jora.Session
- public class Session
- extends java.lang.Object
This class is reposnsible for establishing connection with database
and handling database errors.
Constructor Summary |
Session()
Session consructor for ODBC bridge driver |
Session(java.lang.String driverClass)
Session consructor |
Method Summary |
void |
close()
Close database session and release all resources holded by session. |
void |
commit()
Commit makes all changes made since the previous
commit/rollback permanent and releases any database locks
currently held by the Connection. |
int |
execute(java.lang.String sql)
Execute a SQL INSERT, UPDATE or DELETE statement. |
void |
handleSQLException(java.sql.SQLException ex)
Handler of database session errors. |
boolean |
open(java.lang.String dataSource,
java.lang.String user,
java.lang.String password)
Open database session.
|
void |
rollback()
Rollback drops all changes made since the previous
commit/rollback and releases any database locks currently held
by the Connection. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
connection
public java.sql.Connection connection
Session
public Session(java.lang.String driverClass)
- Session consructor
- Parameters:
driverClass
- class of database driver
Session
public Session()
- Session consructor for ODBC bridge driver
handleSQLException
public void handleSQLException(java.sql.SQLException ex)
- Handler of database session errors. Programmer should override
this method in derived class in order to provide application
dependent error handling.
- Parameters:
ex
- exception thrown by some of JDBC methods
open
public boolean open(java.lang.String dataSource,
java.lang.String user,
java.lang.String password)
- Open database session.
Attempt to establish a connection to the given database URL.
The DriverManager attempts to select an appropriate driver from
the set of registered JDBC drivers.
- Parameters:
url
- a database url of the form
jdbc:subprotocol:subnameuser
- the database user on whose behalf the Connection is being madepassword
- the user's password- Returns:
- true if session is succesfully openned, false otherwise
close
public void close()
- Close database session and release all resources holded by session.
execute
public int execute(java.lang.String sql)
- Execute a SQL INSERT, UPDATE or DELETE statement. In addition,
SQL statements that return nothing such as SQL DDL statements
can be executed.
- Parameters:
sql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothing- Returns:
- either the row count for INSERT, UPDATE or DELETE or 0
for SQL statements that return nothing
commit
public void commit()
- Commit makes all changes made since the previous
commit/rollback permanent and releases any database locks
currently held by the Connection. This method should only be
used when auto commit has been disabled.
rollback
public void rollback()
- Rollback drops all changes made since the previous
commit/rollback and releases any database locks currently held
by the Connection. This method should only be used when auto
commit has been disabled.