Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javatools.db
Class DbConnection  view DbConnection download DbConnection.java

java.lang.Object
  extended byjavatools.db.DbConnection

public class DbConnection
extends java.lang.Object

A Database connection.

Version:
0.2.2

Field Summary
(package private)  java.sql.Connection con
          The real Connection object.
(package private)  java.lang.Thread createdInThread
          It should contain the current thread, or a new thread, in case a specific function in DbDatabase is called.
(package private)  DbDatabase database
          The database to connect to.
 
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.
 void setAutoCommit(boolean value)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

database

DbDatabase database
The database to connect to.


con

java.sql.Connection con
The real Connection object.


createdInThread

java.lang.Thread createdInThread
It should contain the current thread, or a new thread, in case a specific function in DbDatabase is called.

Constructor Detail

DbConnection

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

Method Detail

getSqlConnection

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


isClosed

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


commitClose

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


rollbackClose

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


commit

public void commit()
            throws DbException
Commits all operations.


rollback

public void rollback()
              throws DbException
Rollbacks operations.


close

public void close()
           throws DbException
Closes the connection.


setAutoCommit

public void setAutoCommit(boolean value)
                   throws DbException

finalize

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