edu.wpi.cs.DSRG.xmldb.JDBCClient
Class OracleJDBCClient

java.lang.Object
  |
  +--edu.wpi.cs.DSRG.xmldb.JDBCClient.JDBCClient
        |
        +--edu.wpi.cs.DSRG.xmldb.JDBCClient.OracleJDBCClient

public class OracleJDBCClient
extends JDBCClient

It is a high performanced Oracle JDBC Client. It requires classes12.zip in order to run. It uses following tehniques: 1) disable-autocommit. 2) precompiled statement 3) batch update. Usage: Use the prepareUpdate first to prepare for the update statment. Then, call execute update with proper parameters. It can support more than one prepared statement.


Field Summary
(package private)  java.sql.Connection conn
          The database connection used in this client.
(package private) static int DEFAULT_BATCH_VALUE
          Default Batch value.
(package private) static int DEFAULT_ROW_PREFETCH
          Default Row prefetch.
 
Fields inherited from class edu.wpi.cs.DSRG.xmldb.JDBCClient.JDBCClient
con, DSRG_URL, failedQueries, ODBC_Driver, Oracle_Driver, password, SHIBA_URL, stmt, totalQueries, uri, username, WPI_URL, XMLDB_URL
 
Constructor Summary
OracleJDBCClient()
          Constructor without any open connection.
OracleJDBCClient(JDBCClient client)
          Construct a connect by getting parameter from another connection.
OracleJDBCClient(java.lang.String URI, java.lang.String user, java.lang.String passwd)
          Constructor with one initialized open connection.
 
Method Summary
 void close()
          Close the prepared statment and also it's connection.
 void commit()
          override the parent's commit().
 void executeUpdate(java.sql.PreparedStatement ps, java.util.Vector parameters)
          Execute the update with the input parameters.
 void open(java.lang.String URI, java.lang.String user, java.lang.String passwd)
          Open a new connection to the database.
 java.sql.PreparedStatement prepareUpdate(java.lang.String sql)
          Set the batched update.
 void setDefaultExecuteBatch(int new_default)
          Override the default batch value.
 
Methods inherited from class edu.wpi.cs.DSRG.xmldb.JDBCClient.JDBCClient
finalize, findURI, getConnection, getNumberOfColumns, processQuery
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

conn

java.sql.Connection conn
The database connection used in this client.

DEFAULT_BATCH_VALUE

static final int DEFAULT_BATCH_VALUE
Default Batch value.

DEFAULT_ROW_PREFETCH

static final int DEFAULT_ROW_PREFETCH
Default Row prefetch.
Constructor Detail

OracleJDBCClient

public OracleJDBCClient(JDBCClient client)
                 throws java.sql.SQLException
Construct a connect by getting parameter from another connection.

OracleJDBCClient

public OracleJDBCClient()
                 throws java.sql.SQLException
Constructor without any open connection.

OracleJDBCClient

public OracleJDBCClient(java.lang.String URI,
                        java.lang.String user,
                        java.lang.String passwd)
                 throws java.sql.SQLException
Constructor with one initialized open connection.
Method Detail

prepareUpdate

public java.sql.PreparedStatement prepareUpdate(java.lang.String sql)
                                         throws java.sql.SQLException
Set the batched update. In format of prepared statement. e.g. "insert into dept values (?, ?, ?)" User need to remember to close the prepared statements.

setDefaultExecuteBatch

public void setDefaultExecuteBatch(int new_default)
                            throws java.sql.SQLException
Override the default batch value.

executeUpdate

public void executeUpdate(java.sql.PreparedStatement ps,
                          java.util.Vector parameters)
                   throws java.sql.SQLException
Execute the update with the input parameters. We assume the user know number of parameters required. User can write their own function to call this statement, e.g., executeUpdate(int, String, String) for three parameters.

commit

public void commit()
            throws java.sql.SQLException
override the parent's commit().
Overrides:
commit in class JDBCClient

close

public void close()
           throws java.sql.SQLException
Close the prepared statment and also it's connection. This client is no longer useable. User has to use open in order to use this client, otherwise, user will go exception.

open

public void open(java.lang.String URI,
                 java.lang.String user,
                 java.lang.String passwd)
          throws java.sql.SQLException
Open a new connection to the database.