sky.engine.connector.database
Class DBConnection

java.lang.Object
  extended bysky.engine.connector.database.DBConnection

public class DBConnection
extends java.lang.Object

DBConnection is used by forms to query and update back-end relational database.

$RCSfile: DBConnection.java,v $
$Revision: 1.5 $, $Date: 2005/04/24 03:14:04 $


Field Summary
static FormattedResourceBundle STRINGS
           
 
Constructor Summary
DBConnection(java.lang.String jdrv, java.lang.String jurl, int maxstmts, int id)
          Constructor
 
Method Summary
 void clear()
          Resets state information for all the statements in this connection.
 void clear(int id)
          resets all state information associated with a given statement in this connection.
 void close()
          Clear all state information and close this connection.
 boolean connectsTo(java.lang.String jdrv, java.lang.String jurl)
          Check if this connection connects using a perticular JDBC driver and JDBC URL.
 DBRowIterator executeQuery(int id, java.lang.String query)
          Execute a SELECT query.
 int executeUpdate(int id, java.lang.String query)
          Execute INSERT, UPDATE, DELETE, CREATE, DROP statements.
 int getConnectionID()
          Get unique id of this connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRINGS

public static final FormattedResourceBundle STRINGS
Constructor Detail

DBConnection

public DBConnection(java.lang.String jdrv,
                    java.lang.String jurl,
                    int maxstmts,
                    int id)
             throws ErrorMessage
Constructor

Parameters:
jdrv - JDBC driver name
jurl - JDBC dirver URL.
maxstmts - Maximum number of statements that this connection can have.
id - unique id of this connection.
Throws:
ErrorMessage - if there is a runtime error.
Method Detail

executeQuery

public DBRowIterator executeQuery(int id,
                                  java.lang.String query)
                           throws ErrorMessage
Execute a SELECT query.

Parameters:
id - unique id that identifies the query.
query - query string.
Returns:
result set iterator.
Throws:
ErrorMessage - if there is an error.

executeUpdate

public int executeUpdate(int id,
                         java.lang.String query)
                  throws ErrorMessage
Execute INSERT, UPDATE, DELETE, CREATE, DROP statements.

Parameters:
id - unique id that identifies the query.
query - query string.
Returns:
number of rows that were updated in the database.
Throws:
ErrorMessage - if there is an error.

clear

public void clear(int id)
resets all state information associated with a given statement in this connection.

Parameters:
id - statement id.

clear

public void clear()
Resets state information for all the statements in this connection.


close

public void close()
           throws ErrorMessage
Clear all state information and close this connection.

Throws:
ErrorMessage - if there is an error.

connectsTo

public boolean connectsTo(java.lang.String jdrv,
                          java.lang.String jurl)
Check if this connection connects using a perticular JDBC driver and JDBC URL.

Parameters:
jdrv - JDBC driver name.
jurl - JDBC url for the back-end database.
Returns:
true if there connection uses specified JDBC driver and URL; else, false.

getConnectionID

public int getConnectionID()
Get unique id of this connection

Returns:
connection id.