javatools.db
Class DbConnection

java.lang.Object
  |
  +--javatools.db.DbConnection

public class DbConnection
extends java.lang.Object

A Database connection.


Constructor Summary
DbConnection(DbDatabase database, java.sql.Connection con)
          Creates a new DbConnection.
 
Method Summary
 void close()
          Closes the connection.
 void commit()
          Commits all operations.
 void commitClose()
          Commits all the operations and closes the connection.
protected  void finalize()
          Destroys this object.
 java.sql.Connection getSqlConnection()
          Returns the real JDBC connection.
 boolean isClosed()
          Checks if this connection is closed.
 void rollback()
          Rollbacks operations.
 void rollbackClose()
          Rollbacks operations and closes the connection.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbConnection

public DbConnection(DbDatabase database,
                    java.sql.Connection con)
Creates a new DbConnection.

Parameters:
database - The database to connect to.
con - The real JDBC connection.
Method Detail

getSqlConnection

public java.sql.Connection getSqlConnection()
Returns the real JDBC connection. It is useful to send commands directly to JDBC.

Returns:
The needed connection.

isClosed

public boolean isClosed()
                 throws DbException
Checks if this connection is closed.

Returns:
true: if this connection is closed; false: if it is open.
Throws:
DbException - If something goes wrong.

commitClose

public void commitClose()
                 throws DbException
Commits all the operations and closes the connection.

Throws:
DbException - If something goes wrong.

rollbackClose

public void rollbackClose()
                   throws DbException
Rollbacks operations and closes the connection.

Throws:
DbException - If something goes wrong.

commit

public void commit()
            throws DbException
Commits all operations.

Throws:
DbException - If something goes wrong.

rollback

public void rollback()
              throws DbException
Rollbacks operations.

Throws:
DbException - If something goes wrong.

close

public void close()
           throws DbException
Closes the connection.

Throws:
DbException - If something goes wrong.

finalize

protected void finalize()
                 throws java.lang.Throwable
Destroys this object.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - If something goes wrong.