edu.washington.cs.rfid.data.db
Class SimplePostgresConnection

java.lang.Object
  extended by edu.washington.cs.rfid.data.db.SimpleDBConnection
      extended by edu.washington.cs.rfid.data.db.SimplePostgresConnection

public class SimplePostgresConnection
extends SimpleDBConnection

Wrapper for JDBC, provides base functionality for creating and using a single connection.

Author:
Evan

Constructor Summary
SimplePostgresConnection(DBParameters params)
          Creates a new SimplePostgresConnection.
SimplePostgresConnection(DBParameters params, java.lang.String hostname, int port, java.lang.String dbname, java.lang.String username, char[] pw)
          Creates a new SimplePostgresConnection.
SimplePostgresConnection(java.lang.String hostname, java.lang.String dbname, java.lang.String username, char[] pw)
          Creates a new SimplePostgresConnection.
 
Method Summary
 void close()
          Closes the database connection.
 boolean commit()
          Commits any outstanding transactions.
 java.sql.Statement createStatement()
          Creates a new database statement.
 boolean isConnected()
          Returns true if the database connection is active, false o/w.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlQuery)
          Creates a new database prepared statement.
 boolean rollback()
          Rolls back to the last committed transaction.
 boolean setAutoCommit(boolean a)
          Sets the auto commit mode for this connection.
 
Methods inherited from class edu.washington.cs.rfid.data.db.SimpleDBConnection
checkSQL
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePostgresConnection

public SimplePostgresConnection(java.lang.String hostname,
                                java.lang.String dbname,
                                java.lang.String username,
                                char[] pw)
Creates a new SimplePostgresConnection.


SimplePostgresConnection

public SimplePostgresConnection(DBParameters params,
                                java.lang.String hostname,
                                int port,
                                java.lang.String dbname,
                                java.lang.String username,
                                char[] pw)
Creates a new SimplePostgresConnection.


SimplePostgresConnection

public SimplePostgresConnection(DBParameters params)
Creates a new SimplePostgresConnection.

Method Detail

setAutoCommit

public boolean setAutoCommit(boolean a)
Sets the auto commit mode for this connection.

Specified by:
setAutoCommit in class SimpleDBConnection

commit

public boolean commit()
Commits any outstanding transactions.

Specified by:
commit in class SimpleDBConnection

rollback

public boolean rollback()
Rolls back to the last committed transaction.

Specified by:
rollback in class SimpleDBConnection

isConnected

public boolean isConnected()
Returns true if the database connection is active, false o/w.

Specified by:
isConnected in class SimpleDBConnection

createStatement

public java.sql.Statement createStatement()
Creates a new database statement.

Specified by:
createStatement in class SimpleDBConnection

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sqlQuery)
Creates a new database prepared statement.

Specified by:
prepareStatement in class SimpleDBConnection

close

public void close()
Closes the database connection.

Specified by:
close in class SimpleDBConnection