Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.driver.Connection Class Reference

Collaboration diagram for org.objectweb.cjdbc.driver.Connection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Connection ()
 Connection (Driver driver, Socket socket, CJDBCInputStream in, CJDBCOutputStream out, String url, String userName, String password, boolean sqlSkeletonNeeded, AbstractBlobFilter filter)
String getURL ()
String getUserName ()
String getPassword ()
String getConnectedController ()
void clearWarnings () throws SQLException
void close () throws SQLException
void commit () throws SQLException
java.sql.Statement createStatement () throws SQLException
java.sql.Statement createStatement (int resultSetType, int resultSetConcurrency) throws SQLException
boolean getAutoCommit () throws SQLException
java.sql.DatabaseMetaData getMetaData () throws SQLException
String getCatalog () throws SQLException
ResultSet getCatalogs () throws SQLException
int getTransactionIsolation () throws SQLException
java.util.Map getTypeMap () throws SQLException
SQLWarning getWarnings () throws SQLException
boolean isClosed () throws SQLException
boolean isReadOnly () throws SQLException
String nativeSQL (String query) throws SQLException
java.sql.CallableStatement prepareCall (String sql) throws SQLException
java.sql.CallableStatement prepareCall (String sql, int resultSetType, int resultSetConcurrency) throws SQLException
java.sql.PreparedStatement prepareStatement (String sql) throws SQLException
java.sql.PreparedStatement prepareStatement (String sql, int resultSetType, int resultSetConcurrency) throws SQLException
void rollback () throws SQLException
void setAutoCommit (boolean autoCommit) throws SQLException
void setCatalog (String catalog) throws SQLException
void setReadOnly (boolean readOnly) throws SQLException
void setTransactionIsolation (int level) throws SQLException
void setTypeMap (java.util.Map map) throws SQLException
ResultSet execReadStoredProcedure (StoredProcedure proc) throws SQLException
Object getStaticMetadata (String key) throws SQLException
String getControllerVersionNumber () throws SQLException
void setHoldability (int holdability) throws SQLException
int getHoldability () throws SQLException
Savepoint setSavepoint () throws SQLException
Savepoint setSavepoint (String name) throws SQLException
void rollback (Savepoint savepoint) throws SQLException
void releaseSavepoint (Savepoint savepoint) throws SQLException
java.sql.Statement createStatement (int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
java.sql.PreparedStatement prepareStatement (String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
java.sql.CallableStatement prepareCall (String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
java.sql.PreparedStatement prepareStatement (String sql, int autoGeneratedKeys) throws SQLException
java.sql.PreparedStatement prepareStatement (String sql, int columnIndexes[]) throws SQLException
java.sql.PreparedStatement prepareStatement (String sql, String columnNames[]) throws SQLException
AbstractBlobFilter getBlobFilter ()
ResultSet getTableTypes () throws SQLException
ResultSet getTablePrivileges (String catalog, String schemaPattern, String tableNamePattern) throws SQLException
ResultSet getSchemas () throws SQLException
String getDatabaseProductName () throws SQLException
void fetchNextData (String cursorName, int fetchSize, DriverResultSet drsToUpdate) throws SQLException
void closeRemoteResultSet (String cursorName) throws SQLException
String getPreparedStatementBooleanFalse ()
void setPreparedStatementBooleanFalse (String booleanFalse)
String getPreparedStatementBooleanTrue ()
void setPreparedStatementBooleanTrue (String booleanTrue)
boolean isEscapeBackslash ()
void setEscapeBackslash (boolean escapeBackslash)
boolean isEscapeSingleQuote ()
void setEscapeSingleQuote (boolean escapeSingleQuote)
void setDriverProcessed (boolean processedByDriver)
boolean isDriverProcessed ()
void setEscapeChar (String escapeChar)
String getEscapeChar ()

Static Public Attributes

final String TAG_MARKER = "!%"
final String TAG_MARKER_ESCAPE = TAG_MARKER + ";"
final String START_PARAM_TAG = "<" + TAG_MARKER
final String END_PARAM_TAG = "|" + TAG_MARKER + ">"

Protected Member Functions

void finalize () throws Throwable
java.sql.ResultSet getProcedures (String catalog, String schemaPattern, String procedureNamePattern) throws SQLException
java.sql.ResultSet getProcedureColumns (String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException
void setConnectionParametersOnRequest (AbstractRequest request)
java.sql.ResultSet execReadRequest (SelectRequest request) throws SQLException
void setCloseSocketOnGC (boolean closeSocketOnGC)
int execWriteRequest (AbstractWriteRequest request) throws SQLException
ResultSet execWriteRequestWithKeys (AbstractWriteRequest request) throws SQLException
int execWriteStoredProcedure (StoredProcedure proc) throws SQLException
ResultSet getColumns (String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException
ResultSet getPrimaryKeys (String catalog, String schemaPattern, String tableNamePattern) throws SQLException
ResultSet getTables (String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException

Protected Attributes

boolean autoCommit = true
boolean isClosed = false
boolean readOnly = false
int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED
long transactionId = 0
boolean needSqlSkeleton = false
SQLWarning firstWarning = null
DatabaseMetaData metaData = null
Driver driver = null
String url = null
String vdbUser = null
String vdbPassword = null
Socket socket
CJDBCInputStream socketInput
CJDBCOutputStream socketOutput
boolean escapeBackslash = true
boolean escapeSingleQuote = true
boolean driverProcessed = true
String preparedStatementBooleanTrue = "'1'"
String preparedStatementBooleanFalse = "'0'"
String escapeChar = "\'"

Static Protected Attributes

final String LINE_SEPARATOR

Package Attributes

boolean writeExecutedInTransaction = false

Detailed Description

This Connection class implements a virtual connection that is just used to store the needed information when the real connection will have to be established by the Controller to execute a query.

This code has been inspired from the PostgreSQL JDBC driver by Peter T. Mount.

Author:
Emmanuel Cecchet

Julie Marguerite

Vadim Kassin

Duncan Smith

Nicolas Modrzyk

Jaco Swart

Version:
1.0

Definition at line 67 of file Connection.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.driver.Connection.Connection  ) 
 

Creates a new Connection instance.

Definition at line 159 of file Connection.java.

00160   {
00161   }

org.objectweb.cjdbc.driver.Connection.Connection Driver  driver,
Socket  socket,
CJDBCInputStream  in,
CJDBCOutputStream  out,
String  url,
String  userName,
String  password,
boolean  sqlSkeletonNeeded,
AbstractBlobFilter  filter
 

Creates a new Connection instance.

Parameters:
driver calling driver
socket connection with the controller
in socket input stream
out socket output stream
url C-JDBC URL of the database
userName user login
password user password
sqlSkeletonNeeded true if SQL skeletons must be sent to the controller
filter to use to encode and decode blobs

Definition at line 177 of file Connection.java.

00180   {
00181     this.driver = driver;
00182     this.socket = socket;
00183     this.socketInput = in;
00184     this.socketOutput = out;
00185     this.url = url;
00186     this.vdbUser = userName;
00187     this.vdbPassword = password;
00188     this.needSqlSkeleton = sqlSkeletonNeeded;
00189     this.blobFilter = filter;
00190   }


Member Function Documentation

void org.objectweb.cjdbc.driver.Connection.clearWarnings  )  throws SQLException
 

After this call, getWarnings() returns null until a new warning is reported for this connection.

Exceptions:
SQLException if a database access error occurs

Definition at line 281 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.firstWarning.

00282   {
00283     firstWarning = null;
00284   }

void org.objectweb.cjdbc.driver.Connection.close  )  throws SQLException
 

Releases the connection. In fact, the connection is marked to be released but will be effectively closed by the ConnectionClosingThread if the connection has not been reused before.

Exceptions:
SQLException if an error occurs

Definition at line 293 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.autoCommit, org.objectweb.cjdbc.driver.Driver.connectionClosingThreadisAlive, org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.isClosed, org.objectweb.cjdbc.driver.Driver.pendingConnectionClosing, org.objectweb.cjdbc.driver.Connection.readOnly, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.Statement.close(), org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton(), org.objectweb.cjdbc.driver.Connection.finalize(), and org.objectweb.cjdbc.driver.Statement.getMoreResults().

00294   {
00295     // We synchronize here in the case 2 threads try to call close()
00296     // concurrently on this connection.
00297     synchronized (this)
00298     {
00299       if (isClosed)
00300         return;
00301       else
00302         isClosed = true;
00303     }
00304 
00305     try
00306     {
00307       autoCommit = true;
00308       readOnly = false;
00309       socketOutput.writeInt(Commands.Reset);
00310       socketOutput.flush();
00311     }
00312     catch (Exception e)
00313     {
00314       throw new SQLException("Error while closing the connection: " + e);
00315     }
00316 
00317     synchronized (driver.pendingConnectionClosing)
00318     {
00319       if (!driver.connectionClosingThreadisAlive)
00320       { // First connection to close, start a new closing thread
00321         ConnectionClosingThread t = new ConnectionClosingThread(driver);
00322         t.start();
00323       }
00324       // Add to the list
00325       driver.pendingConnectionClosing.add(this);
00326     }
00327   }

void org.objectweb.cjdbc.driver.Connection.closeRemoteResultSet String  cursorName  )  throws SQLException
 

Closes the remote ResultSet given its cursor name.

Parameters:
cursorName cursor name of the ResultSet to close.
Exceptions:
SQLException if an error occurs

Definition at line 2202 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.close().

02203   {
02204     try
02205     {
02206       socketOutput.writeInt(Commands.CloseRemoteResultSet);
02207       socketOutput.writeUTF(cursorName);
02208       socketOutput.flush();
02209 
02210       Object data = socketInput.readObject();
02211       if (data instanceof CommandCompleted)
02212         return;
02213       else if (data instanceof SQLException)
02214         throw (SQLException) data;
02215       else
02216         throw new SQLException(
02217             "Connection.closeRemoteResultSet: Unexpected response (" + data
02218                 + ")");
02219     }
02220     catch (Exception e)
02221     {
02222       throw new SQLException(
02223           "Connection.closeRemoteResultSet: Error occured while request was processed by C-JDBC Controller ("
02224               + e + ")");
02225     }
02226   }

void org.objectweb.cjdbc.driver.Connection.commit  )  throws SQLException
 

Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should only be used when auto-commit has been disabled. (If autoCommit==true, then we throw an SQLException).

Exceptions:
SQLException if a database access error occurs or the connection is in autocommit mode
See also:
Connection.setAutoCommit

Definition at line 340 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, org.objectweb.cjdbc.driver.Connection.transactionId, and org.objectweb.cjdbc.driver.Connection.writeExecutedInTransaction.

00341   {
00342     if (autoCommit)
00343       throw new SQLException("Trying to commit a connection in autocommit mode");
00344 
00345     if (driver == null)
00346       throw new SQLException("No driver to send the commit request");
00347     try
00348     {
00349       socketOutput.writeInt(Commands.Commit);
00350       socketOutput.flush();
00351       // Commit is followed by a BEGIN
00352       Object r = socketInput.readObject();
00353       writeExecutedInTransaction = false;
00354       if (r instanceof Long)
00355         transactionId = ((Long) r).longValue();
00356       else
00357         throw new SQLException(
00358             "Error occured while trying to start transaction after commit on C-JDBC Controller ("
00359                 + r + ")");
00360     }
00361     catch (Exception e)
00362     {
00363       throw new SQLException("Error occured while commit of transaction '"
00364           + transactionId + "' was processed by C-JDBC Controller (" + e + ")");
00365     }
00366   }

java.sql.Statement org.objectweb.cjdbc.driver.Connection.createStatement int  resultSetType,
int  resultSetConcurrency,
int  resultSetHoldability
throws SQLException
 

Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.

This method is the same as the createStatement method above, but it allows the default result set type, concurrency, and holdability to be overridden.

Parameters:
resultSetType one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetHoldability one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Returns:
a new Statement object that will generate ResultSet objects with the given type, concurrency, and holdability
Exceptions:
SQLException if a database access error occurs or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
See also:
ResultSet
Since:
JDK 1.4

Definition at line 1803 of file Connection.java.

01805   {
01806     throw new NotImplementedException("createStatement");
01807   }

java.sql.Statement org.objectweb.cjdbc.driver.Connection.createStatement int  resultSetType,
int  resultSetConcurrency
throws SQLException
 

SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement.

Parameters:
resultSetType resultSetType to use
resultSetConcurrency resultSetConcurrency to use
Returns:
a new Statement object
Exceptions:
SQLException passed through from the constructor

Definition at line 393 of file Connection.java.

References org.objectweb.cjdbc.driver.Statement.setResultSetConcurrency(), and org.objectweb.cjdbc.driver.Statement.setResultSetType().

00395   {
00396     Statement s = new Statement(this);
00397     s.setResultSetType(resultSetType);
00398     s.setResultSetConcurrency(resultSetConcurrency);
00399     return s;
00400   }

java.sql.Statement org.objectweb.cjdbc.driver.Connection.createStatement  )  throws SQLException
 

SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement. The ResultSet will be TYPE_FORWARD_ONLY</cde>/CONCUR_READ_ONLY. *

Returns:
a new Statement object
Exceptions:
SQLException passed through from the constructor

Definition at line 378 of file Connection.java.

00379   {
00380     return new Statement(this);
00381   }

java.sql.ResultSet org.objectweb.cjdbc.driver.Connection.execReadRequest SelectRequest  request  )  throws SQLException [protected]
 

Performs a read request and return the reply.

Parameters:
request the read request to execute
Returns:
a java.sql.ResultSet value
Exceptions:
SQLException if an error occurs

Definition at line 930 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Driver.getControllerConfig(), org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest(), org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.Statement.executeQuery().

00932   {
00933     if (driver == null)
00934       throw new SQLException("No driver to send the request '"
00935           + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH) + "'");
00936     try
00937     {
00938       setConnectionParametersOnRequest(request);
00939       socketOutput.writeInt(Commands.ExecReadRequest);
00940       readRequestOnStream(request);
00941       socketOutput.flush();
00942 
00943       Object in = socketInput.readObject();
00944       if (in instanceof NoMoreBackendException)
00945       {
00946         try
00947         {
00948           // If there is only one controller available rethrow the exception
00949           if (driver.getControllerConfig().size() == 1)
00950             throw (SQLException) in;
00951           else
00952           {
00953             // otherwise try to connect to an other controller and re-execute
00954             // the query
00955             reconnect();
00956             return execReadRequest(request);
00957           }
00958         }
00959         catch (SQLException e1)
00960         {
00961           // We deal with this exception in the follwoing if block
00962           in = e1;
00963         }
00964       }
00965       if (in instanceof IOException)
00966       {
00967         reconnect();
00968         return execReadRequest(request);
00969       }
00970       else if (in instanceof SQLException)
00971       {
00972         throw (SQLException) in;
00973       }
00974       else if (in instanceof Field[])
00975       { // Get the ResultSet metadata the row data
00976         Field[] fields = (Field[]) in;
00977         ArrayList data = null;
00978         boolean hasMoreData;
00979         String cursorName = null;
00980         try
00981         {
00982           data = (ArrayList) socketInput.readObject();
00983           hasMoreData = socketInput.readBoolean();
00984           if (hasMoreData)
00985             cursorName = socketInput.readUTF();
00986         }
00987         catch (IOException e)
00988         {
00989           reconnect();
00990           return execReadRequest(request);
00991         }
00992         catch (Exception e1)
00993         {
00994           throw new SQLException(
00995               "Connection.execReadRequest: Unexpected response (" + e1
00996                   + ") for request "
00997                   + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
00998         }
00999         return new org.objectweb.cjdbc.driver.DriverResultSet(fields, data,
01000             hasMoreData, cursorName);
01001       }
01002       else
01003       {
01004         throw new SQLException(
01005             "Connection.execReadRequest: Unexpected response (" + in
01006                 + ") for request "
01007                 + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01008       }
01009 
01010     }
01011     catch (RuntimeException e)
01012     {
01013       e.printStackTrace();
01014       throw new SQLException(
01015           "Connection.execReadRequest: Error occured while request '"
01016               + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01017               + "' was processed by C-JDBC Controller (" + e + ")");
01018     }
01019     catch (IOException e)
01020     { // Connection failed, try to reconnect and re-exec the query
01021       try
01022       {
01023         reconnect();
01024         return execReadRequest(request);
01025       }
01026       catch (SQLException e1)
01027       {
01028         throw new SQLException("Connection lost while executing request '"
01029             + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01030             + "' and automatic reconnect failed (" + e1 + ")");
01031       }
01032     }
01033     catch (ClassNotFoundException e)
01034     {
01035       e.printStackTrace();
01036       throw new SQLException(
01037           "Connection.execReadRequest: Unexpected response (" + e
01038               + ") for request "
01039               + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01040     }
01041   }

ResultSet org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure StoredProcedure  proc  )  throws SQLException
 

Call a stored procedure that returns a ResultSet.

Parameters:
proc the stored procedure call
Returns:
a java.sql.ResultSet value
Exceptions:
SQLException if an error occurs

Definition at line 1388 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.common.stream.CJDBCOutputStream.flush(), org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest(), org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, and org.objectweb.cjdbc.common.stream.CJDBCOutputStream.writeInt().

Referenced by org.objectweb.cjdbc.driver.Statement.executeQuery().

01390   {
01391     if (driver == null)
01392       throw new SQLException("No driver to send the request '"
01393           + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH) + "'");
01394     try
01395     {
01396       setConnectionParametersOnRequest(proc);
01397       socketOutput.writeInt(Commands.ExecReadStoredProcedure);
01398       procedureOnStream(proc, true);
01399       socketOutput.flush();
01400 
01401       Object in = socketInput.readObject();
01402       if (in instanceof SQLException)
01403         throw (SQLException) in;
01404       else if (in instanceof Field[])
01405       { // Get the ResultSet metadata the row data
01406         Field[] fields = (Field[]) in;
01407         ArrayList data = null;
01408         boolean hasMoreData;
01409         String cursorName = null;
01410         try
01411         {
01412           data = (ArrayList) socketInput.readObject();
01413           hasMoreData = socketInput.readBoolean();
01414           if (hasMoreData)
01415             cursorName = socketInput.readUTF();
01416         }
01417         catch (Exception e1)
01418         {
01419           throw new SQLException(
01420               "Connection.execReadStoredProcedure: Unexpected response (" + e1
01421                   + ") for request "
01422                   + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01423         }
01424         return new org.objectweb.cjdbc.driver.DriverResultSet(fields, data,
01425             hasMoreData, cursorName);
01426       }
01427       else
01428         throw new SQLException(
01429             "Connection.execReadStoredProcedure: Unexpected response (" + in
01430                 + ") for request "
01431                 + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01432     }
01433     catch (RuntimeException e)
01434     {
01435       throw new SQLException(
01436           "Connection.execReadStoredProcedure: Error occured while request '"
01437               + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01438               + "' was processed by C-JDBC Controller (" + e + ")");
01439     }
01440     catch (IOException e)
01441     { // Connection failed, try to reconnect and re-exec the query
01442       try
01443       {
01444         reconnect();
01445         return execReadStoredProcedure(proc);
01446       }
01447       catch (SQLException e1)
01448       {
01449         throw new SQLException("Connection lost while executing request'"
01450             + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01451             + "' and automatic reconnect failed (" + e1 + ")");
01452       }
01453     }
01454     catch (ClassNotFoundException e)
01455     {
01456       throw new SQLException(
01457           "Connection.execReadStoredProcedure: Unexpected response (" + e
01458               + ") for request "
01459               + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01460     }
01461   }

int org.objectweb.cjdbc.driver.Connection.execWriteRequest AbstractWriteRequest  request  )  throws SQLException [protected]
 

Performs a write request and return the number of rows affected.

Parameters:
request the write request to execute
Returns:
number of rows affected
Exceptions:
SQLException if an error occurs

Definition at line 1121 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest(), org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton().

01123   {
01124     if (driver == null)
01125       throw new SQLException("No driver to send the request '"
01126           + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH) + "'");
01127     try
01128     {
01129       setConnectionParametersOnRequest(request);
01130       socketOutput.writeInt(Commands.ExecWriteRequest);
01131       writeRequestOnStream(request, false);
01132       socketOutput.flush();
01133 
01134       Object r = socketInput.readObject();
01135       if (r instanceof Integer)
01136         return ((Integer) r).intValue();
01137       else if (r instanceof SQLException)
01138         throw (SQLException) r;
01139       else
01140         throw new SQLException(
01141             "Connection.execWriteRequest: Unexpected response (" + r
01142                 + ") for request "
01143                 + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01144     }
01145     catch (SQLException e)
01146     {
01147       throw e;
01148     }
01149     catch (IOException e)
01150     { // Connection failed, try to reconnect and re-exec the query
01151       try
01152       {
01153         reconnect();
01154         return execWriteRequest(request);
01155       }
01156       catch (SQLException e1)
01157       {
01158         throw new SQLException("Connection lost while executing request'"
01159             + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01160             + "' and automatic reconnect failed (" + e1 + ")");
01161       }
01162     }
01163     catch (Exception e)
01164     {
01165       throw new SQLException("execWriteRequest: Error occured while request '"
01166           + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01167           + "' was processed by C-JDBC Controller (" + e + ")");
01168     }
01169   }

ResultSet org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys AbstractWriteRequest  request  )  throws SQLException [protected]
 

Performs a write request and return the number of rows affected.

Parameters:
request the write request to execute
Returns:
auto generated keys
Exceptions:
SQLException if an error occurs

Definition at line 1327 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.common.stream.CJDBCOutputStream.flush(), org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest(), org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, and org.objectweb.cjdbc.common.stream.CJDBCOutputStream.writeInt().

Referenced by org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton().

01329   {
01330     if (driver == null)
01331       throw new SQLException("No driver to send the request '"
01332           + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH) + "'");
01333     try
01334     {
01335       setConnectionParametersOnRequest(request);
01336       socketOutput.writeInt(Commands.ExecWriteRequestWithKeys);
01337       writeRequestOnStream(request, true);
01338       socketOutput.flush();
01339 
01340       Object in = socketInput.readObject();
01341       if (in instanceof SQLException)
01342         throw (SQLException) in;
01343       else if (in instanceof Field[])
01344       { // Get the ResultSet metadata the row data
01345         Field[] fields = (Field[]) in;
01346         ArrayList data = null;
01347         boolean hasMoreData;
01348         String cursorName = null;
01349         try
01350         {
01351           data = (ArrayList) socketInput.readObject();
01352           hasMoreData = socketInput.readBoolean();
01353           if (hasMoreData)
01354             cursorName = socketInput.readUTF();
01355         }
01356         catch (Exception e1)
01357         {
01358           throw new SQLException(
01359               "Connection.execWriteRequestWithKeys: Unexpected response (" + e1
01360                   + ") for request "
01361                   + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01362         }
01363         return new org.objectweb.cjdbc.driver.DriverResultSet(fields, data,
01364             hasMoreData, cursorName);
01365       }
01366       else
01367         throw new SQLException(
01368             "Connection.execWriteRequestWithKeys: Unexpected response (" + in
01369                 + ") for request "
01370                 + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01371     }
01372     catch (Exception e)
01373     {
01374       throw new SQLException(
01375           "execWriteRequestWithKeys: Error occured while request '"
01376               + request.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01377               + "' was processed by C-JDBC Controller (" + e + ")");
01378     }
01379   }

int org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure StoredProcedure  proc  )  throws SQLException [protected]
 

Call a stored procedure that performs an update.

Parameters:
proc the stored procedure call
Returns:
number of rows affected
Exceptions:
SQLException if an error occurs

Definition at line 1470 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.common.stream.CJDBCOutputStream.flush(), org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest(), org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, and org.objectweb.cjdbc.common.stream.CJDBCOutputStream.writeInt().

Referenced by org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton().

01472   {
01473     if (driver == null)
01474       throw new SQLException("No driver to send the request '"
01475           + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH) + "'");
01476     try
01477     {
01478       setConnectionParametersOnRequest(proc);
01479       socketOutput.writeInt(Commands.ExecWriteStoredProcedure);
01480       procedureOnStream(proc, false);
01481       socketOutput.flush();
01482 
01483       Object r = socketInput.readObject();
01484       if (r instanceof Integer)
01485         return ((Integer) r).intValue();
01486       else if (r instanceof SQLException)
01487         throw (SQLException) r;
01488       else
01489         throw new SQLException(
01490             "Connection.execWriteStoredProcedure: Unexpected response (" + r
01491                 + ") for request "
01492                 + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH));
01493     }
01494     catch (Exception e)
01495     {
01496       throw new SQLException(
01497           "execWriteStoredProcedure: Error occured while request '"
01498               + proc.getSQLShortForm(Constants.SQL_SHORT_FORM_LENGTH)
01499               + "' was processed by C-JDBC Controller (" + e + ")");
01500     }
01501   }

void org.objectweb.cjdbc.driver.Connection.fetchNextData String  cursorName,
int  fetchSize,
DriverResultSet  drsToUpdate
throws SQLException
 

Fetch next fetchSize rows of data and update the given ResultSet.

Parameters:
cursorName name of the ResultSet cursor
fetchSize number of rows to fetch
drsToUpdate DriverResultSet to update
Exceptions:
SQLException if an error occurs

Definition at line 2165 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.next().

02167   {
02168     try
02169     {
02170       socketOutput.writeInt(Commands.FetchNextResultSetRows);
02171       socketOutput.writeUTF(cursorName);
02172       socketOutput.writeInt(fetchSize);
02173       socketOutput.flush();
02174 
02175       Object data = socketInput.readObject();
02176       if (data instanceof ArrayList)
02177       {
02178         boolean hasMoreData = socketInput.readBoolean();
02179         drsToUpdate.setData((ArrayList) data);
02180         drsToUpdate.setHasMoreData(hasMoreData);
02181       }
02182       else if (data instanceof SQLException)
02183         throw (SQLException) data;
02184       else
02185         throw new SQLException(
02186             "Connection.fetchNextData: Unexpected response (" + data + ")");
02187     }
02188     catch (Exception e)
02189     {
02190       throw new SQLException(
02191           "Connection.fetchNextData: Error occured while request was processed by C-JDBC Controller ("
02192               + e + ")");
02193     }
02194   }

void org.objectweb.cjdbc.driver.Connection.finalize  )  throws Throwable [protected]
 

See also:
java.lang.Object#finalize()

Definition at line 195 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.close(), and org.objectweb.cjdbc.driver.Connection.rollback().

00196   {
00197     if (this.closeSocketOnGC)
00198     {
00199       Throwable t = null;
00200       try
00201       {
00202         rollback();
00203       }
00204       catch (Exception e)
00205       {
00206         t = e;
00207       }
00208       try
00209       {
00210         close();
00211       }
00212       catch (Exception e)
00213       {
00214         t = e;
00215       }
00216 
00217       if (t != null)
00218       {
00219         throw t;
00220       }
00221 
00222     }
00223     super.finalize();
00224   }

boolean org.objectweb.cjdbc.driver.Connection.getAutoCommit  )  throws SQLException
 

Gets the current auto-commit state.

Returns:
current state of the auto-commit mode
Exceptions:
SQLException (why?)
See also:
Connection.setAutoCommit

Definition at line 409 of file Connection.java.

00410   {
00411     return this.autoCommit;
00412   }

AbstractBlobFilter org.objectweb.cjdbc.driver.Connection.getBlobFilter  ) 
 

Returns the blobFilter value.

Returns:
Returns the blobFilter.

Definition at line 2009 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.getBytes(), org.objectweb.cjdbc.driver.DriverResultSet.getObject(), and org.objectweb.cjdbc.driver.PreparedStatement.setBytes().

02010   {
02011     if (blobFilter == null)
02012       blobFilter = new HexaBlobFilter();
02013     return blobFilter;
02014   }

String org.objectweb.cjdbc.driver.Connection.getCatalog  )  throws SQLException
 

Return current catalog name.

Returns:
name of the current VirtualDatabase
Exceptions:
SQLException if any error occurs
See also:
java.sql.Connection#getCatalog()

Definition at line 439 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

00440   {
00441     if (driver == null)
00442       throw new SQLException("No driver to get the catalog.");
00443     try
00444     {
00445       socketOutput.writeInt(Commands.ConnectionGetCatalog);
00446       socketOutput.flush();
00447 
00448       Object rs = socketInput.readObject();
00449       if (rs instanceof String)
00450       {
00451         return (String) rs;
00452       }
00453       else if (rs instanceof SQLException)
00454         throw (SQLException) rs;
00455       else
00456         throw new SQLException("Connection.getCatalog: Unexpected response ("
00457             + rs + ")");
00458     }
00459     catch (Exception e)
00460     {
00461       throw new SQLException(
00462           "Connection.getCatalog: Error occured while request was processed by C-JDBC Controller ("
00463               + e + ")");
00464     }
00465   }

ResultSet org.objectweb.cjdbc.driver.Connection.getCatalogs  )  throws SQLException
 

getCatalogs definition.

Returns:
instace of ResultSet
Exceptions:
SQLException if fails (include ANY exception that can be thrown in the code)

Definition at line 473 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getCatalogs().

00474   {
00475 
00476     if (driver == null)
00477       throw new SQLException("No driver to get the catalogs.");
00478     try
00479     {
00480       socketOutput.writeInt(Commands.ConnectionGetCatalogs);
00481       socketOutput.flush();
00482 
00483       Object rs = socketInput.readObject();
00484       if (rs instanceof ResultSet)
00485         return (ResultSet) rs;
00486       else if (rs instanceof SQLException)
00487         throw (SQLException) rs;
00488       else
00489         throw new SQLException("Connection.getCatalogs: Unexpected response ("
00490             + rs + ")");
00491     }
00492     catch (Exception e)
00493     {
00494       throw new SQLException(
00495           "Connection.getCatalogs: Error occured while request was processed by C-JDBC Controller ("
00496               + e + ")");
00497     }
00498   }

String org.objectweb.cjdbc.driver.Connection.getConnectedController  ) 
 

Get the controller description to which this connection is connected to

Returns:
String like localhost:25322 or null if not connected

Definition at line 262 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.socket.

00263   {
00264     if (socket == null)
00265       return null;
00266     else
00267       return socket.getInetAddress().getHostName() + ":" + socket.getPort();
00268   }

String org.objectweb.cjdbc.driver.Connection.getControllerVersionNumber  )  throws SQLException
 

Get the C-JDBC controller version number.

Returns:
a String containing the controller version
Exceptions:
SQLException if an error occurs

Definition at line 1645 of file Connection.java.

References org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject(), org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getDatabaseProductVersion().

01646   {
01647     try
01648     {
01649       socketOutput.writeInt(Commands.GetControllerVersionNumber);
01650       socketOutput.flush();
01651 
01652       Object s = socketInput.readObject();
01653       if (s instanceof String)
01654         return (String) s;
01655       else
01656         throw new SQLException(
01657             "Connection.getControllerVersionNumber: Unexpected response (" + s
01658                 + ")");
01659     }
01660     catch (Exception e)
01661     {
01662       throw new SQLException(
01663           "Connection.getControllerVersionNumber: Error occured while request was processed by C-JDBC Controller ("
01664               + e + ")");
01665     }
01666   }

String org.objectweb.cjdbc.driver.Connection.getDatabaseProductName  )  throws SQLException
 

See also:
DatabaseMetaData.getDatabaseProductName()

Definition at line 2134 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getDatabaseProductName().

02135   {
02136     try
02137     {
02138       socketOutput.writeInt(Commands.DatabaseMetaDataGetDatabaseProductName);
02139       socketOutput.flush();
02140 
02141       Object s = socketInput.readObject();
02142       if (s instanceof String)
02143         return (String) s;
02144       else
02145         throw new SQLException(
02146             "Connection.GetDatabaseProductName: Unexpected response (" + s
02147                 + ")");
02148     }
02149     catch (Exception e)
02150     {
02151       throw new SQLException(
02152           "Connection.getDatabaseProductName: Error occured while request was processed by C-JDBC Controller ("
02153               + e + ")");
02154     }
02155   }

String org.objectweb.cjdbc.driver.Connection.getEscapeChar  ) 
 

Returns:
Returns the escapeChar.

Definition at line 2342 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.PreparedStatement.doEscapeProcessing().

02343   {
02344     return escapeChar;
02345   }

int org.objectweb.cjdbc.driver.Connection.getHoldability  )  throws SQLException
 

Retrieves the current holdability of ResultSet objects created using this Connection object.

Returns:
the holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Exceptions:
SQLException if a database access occurs
See also:
setHoldability

ResultSet

Since:
JDK 1.4

Definition at line 1701 of file Connection.java.

01702   {
01703     throw new NotImplementedException("getHoldability");
01704   }

java.sql.DatabaseMetaData org.objectweb.cjdbc.driver.Connection.getMetaData  )  throws SQLException
 

A connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is made available through a DatabaseMetaData object.

Returns:
a DatabaseMetaData object for this connection
Exceptions:
SQLException if a database access error occurs

Definition at line 423 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.metaData.

00424   {
00425     if (metaData == null)
00426     {
00427       metaData = new DatabaseMetaData(this);
00428     }
00429     return metaData;
00430   }

String org.objectweb.cjdbc.driver.Connection.getPassword  ) 
 

Gets the password used to login to the database.

Returns:
password

Definition at line 251 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Driver.connect().

00252   {
00253     return vdbPassword;
00254   }

String org.objectweb.cjdbc.driver.Connection.getPreparedStatementBooleanFalse  ) 
 

Returns the booleanFalse value.

Returns:
Returns the booleanFalse.

Definition at line 2233 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.getBoolean(), and org.objectweb.cjdbc.driver.PreparedStatement.setBoolean().

02234   {
02235     return preparedStatementBooleanFalse;
02236   }

String org.objectweb.cjdbc.driver.Connection.getPreparedStatementBooleanTrue  ) 
 

Returns the booleanTrue value.

Returns:
Returns the booleanTrue.

Definition at line 2253 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.DriverResultSet.getBoolean(), and org.objectweb.cjdbc.driver.PreparedStatement.setBoolean().

02254   {
02255     return preparedStatementBooleanTrue;
02256   }

ResultSet org.objectweb.cjdbc.driver.Connection.getPrimaryKeys String  catalog,
String  schemaPattern,
String  tableNamePattern
throws SQLException [protected]
 

See also:
java.sql.DatabaseMetaData#getPrimaryKeys

Definition at line 1539 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject(), org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getPrimaryKeys().

01541   {
01542     if (driver == null)
01543       throw new SQLException("No driver to get the tables.");
01544     try
01545     {
01546       socketOutput.writeInt(Commands.DatabaseMetaDataGetPrimaryKeys);
01547       socketOutput.writeUTF(catalog);
01548       socketOutput.writeUTF(schemaPattern);
01549       socketOutput.writeUTF(tableNamePattern);
01550       socketOutput.flush();
01551 
01552       Object rs = socketInput.readObject();
01553       if (rs == null)
01554         return null;
01555       if (rs instanceof ResultSet)
01556         return (ResultSet) rs;
01557       else if (rs instanceof SQLException)
01558         throw (SQLException) rs;
01559       else
01560         throw new SQLException(
01561             "Connection.getPrimaryKeys: Unexpected response (" + rs + ")");
01562     }
01563     catch (Exception e)
01564     {
01565       throw new SQLException(
01566           "Connection.getPrimaryKeys: Error occured while request was processed by C-JDBC Controller ("
01567               + e + ")");
01568     }
01569   }

ResultSet org.objectweb.cjdbc.driver.Connection.getSchemas  )  throws SQLException
 

See also:
java.sql.DatabaseMetaData#getSchemas()

Definition at line 2103 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getSchemas().

02104   {
02105     if (driver == null)
02106       throw new SQLException("No driver to get the schemas.");
02107     try
02108     {
02109       socketOutput.writeInt(Commands.DatabaseMetaDataGetSchemas);
02110       socketOutput.flush();
02111 
02112       Object rs = socketInput.readObject();
02113       if (rs == null)
02114         return null;
02115       if (rs instanceof ResultSet)
02116         return (ResultSet) rs;
02117       else if (rs instanceof SQLException)
02118         throw (SQLException) rs;
02119       else
02120         throw new SQLException("Connection.getSchemas: Unexpected response ("
02121             + rs + ")");
02122     }
02123     catch (Exception e)
02124     {
02125       throw new SQLException(
02126           "Connection.getSchemas: Error occured while request was processed by C-JDBC Controller ("
02127               + e + ")");
02128     }
02129   }

Object org.objectweb.cjdbc.driver.Connection.getStaticMetadata String  key  )  throws SQLException
 

Retrieve a metadata from the controller

Parameters:
key the name of the metadata to retrieve
Returns:
an Object that will be an Integer or Boolean or String
Exceptions:
SQLException if fails

Definition at line 1616 of file Connection.java.

References org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject(), org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

01617   {
01618     try
01619     {
01620       socketOutput.writeInt(Commands.DatabaseStaticMetadata);
01621       socketOutput.writeUTF(key);
01622       socketOutput.flush();
01623 
01624       Object s = socketInput.readObject();
01625       if (s instanceof SQLException)
01626         throw (SQLException) s;
01627       else
01628         return s;
01629     }
01630     catch (Exception e)
01631     {
01632       throw new SQLException(
01633           "Connection.getStaticMetadata: Error occured while request was processed by C-JDBC Controller ("
01634               + e + ")");
01635     }
01636 
01637   }

ResultSet org.objectweb.cjdbc.driver.Connection.getTablePrivileges String  catalog,
String  schemaPattern,
String  tableNamePattern
throws SQLException
 

Gets a description of the access rights for each table available in a catalog. Note that a table privilege applies to one or more columns in the table. It would be wrong to assume that this priviledge applies to all columns (this may be true for some systems but is not true for all.) Only privileges matching the schema and table name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME, and PRIVILEGE.

Parameters:
catalog a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schemaPattern a schema name pattern; "" retrieves those without a schema
tableNamePattern a table name pattern
Returns:
ResultSet each row is a table privilege description
Exceptions:
SQLException if a database access error occurs

Definition at line 2068 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getTablePrivileges().

02070   {
02071     if (driver == null)
02072       throw new SQLException("No driver to get the table privileges.");
02073     try
02074     {
02075       socketOutput.writeInt(Commands.DatabaseMetaDataGetTablePrivileges);
02076       socketOutput.writeUTF(catalog);
02077       socketOutput.writeUTF(schemaPattern);
02078       socketOutput.writeUTF(tableNamePattern);
02079       socketOutput.flush();
02080 
02081       Object rs = socketInput.readObject();
02082       if (rs == null)
02083         return null;
02084       if (rs instanceof ResultSet)
02085         return (ResultSet) rs;
02086       else if (rs instanceof SQLException)
02087         throw (SQLException) rs;
02088       else
02089         throw new SQLException(
02090             "Connection.getTablePrivileges: Unexpected response (" + rs + ")");
02091     }
02092     catch (Exception e)
02093     {
02094       throw new SQLException(
02095           "Connection.getTablePrivileges: Error occured while request was processed by C-JDBC Controller ("
02096               + e + ")");
02097     }
02098   }

ResultSet org.objectweb.cjdbc.driver.Connection.getTables String  catalog,
String  schemaPattern,
String  tableNamePattern,
String[]  types
throws SQLException [protected]
 

See also:
org.objectweb.cjdbc.driver.DatabaseMetaData.getTables(String, String, String, String[])

Definition at line 1575 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject(), org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getTables().

01577   {
01578     if (driver == null)
01579       throw new SQLException("No driver to get the tables.");
01580     try
01581     {
01582       socketOutput.writeInt(Commands.DatabaseMetaDataGetTables);
01583       socketOutput.writeUTF(catalog);
01584       socketOutput.writeUTF(schemaPattern);
01585       socketOutput.writeUTF(tableNamePattern);
01586       socketOutput.writeObject(types);
01587       socketOutput.flush();
01588 
01589       Object rs = socketInput.readObject();
01590       if (rs == null)
01591         return null;
01592       if (rs instanceof ResultSet)
01593         return (ResultSet) rs;
01594       else if (rs instanceof SQLException)
01595         throw (SQLException) rs;
01596       else
01597         throw new SQLException("Connection.getTables: Unexpected response ("
01598             + rs + ")");
01599     }
01600     catch (Exception e)
01601     {
01602       throw new SQLException(
01603           "Connection.getTables: Error occured while request was processed by C-JDBC Controller ("
01604               + e + ")");
01605     }
01606   }

ResultSet org.objectweb.cjdbc.driver.Connection.getTableTypes  )  throws SQLException
 

Gets the table types available in this database. The results are ordered by table type.

Returns:
ResultSet each row has a single String column that is a catalog name
Exceptions:
SQLException if a database error occurs

Definition at line 2024 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, and org.objectweb.cjdbc.driver.Connection.socketOutput.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.getTableTypes().

02025   {
02026     if (driver == null)
02027       throw new SQLException("No driver to get the table types.");
02028     try
02029     {
02030       socketOutput.writeInt(Commands.DatabaseMetaDataGetTableTypes);
02031       socketOutput.flush();
02032 
02033       Object rs = socketInput.readObject();
02034       if (rs == null)
02035         return null;
02036       if (rs instanceof ResultSet)
02037         return (ResultSet) rs;
02038       else if (rs instanceof SQLException)
02039         throw (SQLException) rs;
02040       else
02041         throw new SQLException(
02042             "Connection.getTableTypes: Unexpected response (" + rs + ")");
02043     }
02044     catch (Exception e)
02045     {
02046       throw new SQLException(
02047           "Connection.getTableTypes: Error occured while request was processed by C-JDBC Controller ("
02048               + e + ")");
02049     }
02050   }

int org.objectweb.cjdbc.driver.Connection.getTransactionIsolation  )  throws SQLException
 

Gets this Connection's current transaction isolation mode.

Returns:
the current TRANSACTION_* mode value
Exceptions:
SQLException if a database access error occurs

Definition at line 568 of file Connection.java.

00569   {
00570     return isolationLevel;
00571   }

java.util.Map org.objectweb.cjdbc.driver.Connection.getTypeMap  )  throws SQLException
 

C-JDBC does NOT support type map.

Returns:
an exception
Exceptions:
SQLException not supported

Definition at line 579 of file Connection.java.

00580   {
00581     throw new NotImplementedException("getTypeMap()");
00582   }

String org.objectweb.cjdbc.driver.Connection.getURL  ) 
 

Gets the C-JDBC URL of the database of the connection.

Returns:
value of url.

Definition at line 231 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Driver.connect(), and org.objectweb.cjdbc.driver.DatabaseMetaData.getURL().

00232   {
00233     return url;
00234   }

String org.objectweb.cjdbc.driver.Connection.getUserName  ) 
 

Gets the user name used to login to the database.

Returns:
login name

Definition at line 241 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Driver.connect(), and org.objectweb.cjdbc.driver.DatabaseMetaData.getUserName().

00242   {
00243     return vdbUser;
00244   }

SQLWarning org.objectweb.cjdbc.driver.Connection.getWarnings  )  throws SQLException
 

The first warning reported by calls on this connection is returned. Note: Sebsequent warnings will be changed to this SQLWarning

Returns:
the first SQLWarning or null
Exceptions:
SQLException if a database access error occurs

Definition at line 591 of file Connection.java.

00592   {
00593     return firstWarning;
00594   }

boolean org.objectweb.cjdbc.driver.Connection.isClosed  )  throws SQLException
 

Returns true if the connection is closed (no real meaning from C-JDBC point of view)

Returns:
true if connection has never been opened or close() has been called
Exceptions:
SQLException if an error occurs

Definition at line 604 of file Connection.java.

00605   {
00606     return isClosed;
00607   }

boolean org.objectweb.cjdbc.driver.Connection.isDriverProcessed  ) 
 

Returns the driverProcessed value.

Returns:
Returns the driverProcessed.

Definition at line 2324 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Statement.executeQuery(), org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton(), org.objectweb.cjdbc.driver.PreparedStatement.setBigDecimal(), org.objectweb.cjdbc.driver.PreparedStatement.setBlob(), org.objectweb.cjdbc.driver.PreparedStatement.setBoolean(), org.objectweb.cjdbc.driver.PreparedStatement.setByte(), org.objectweb.cjdbc.driver.PreparedStatement.setBytes(), org.objectweb.cjdbc.driver.PreparedStatement.setClob(), org.objectweb.cjdbc.driver.PreparedStatement.setDate(), org.objectweb.cjdbc.driver.PreparedStatement.setDouble(), org.objectweb.cjdbc.driver.PreparedStatement.setFloat(), org.objectweb.cjdbc.driver.PreparedStatement.setInt(), org.objectweb.cjdbc.driver.PreparedStatement.setLong(), org.objectweb.cjdbc.driver.PreparedStatement.setNull(), org.objectweb.cjdbc.driver.PreparedStatement.setObject(), org.objectweb.cjdbc.driver.PreparedStatement.setShort(), org.objectweb.cjdbc.driver.PreparedStatement.setString(), org.objectweb.cjdbc.driver.PreparedStatement.setTime(), and org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp().

02325   {
02326     return driverProcessed;
02327   }

boolean org.objectweb.cjdbc.driver.Connection.isEscapeBackslash  ) 
 

Returns the escapeBackslash value.

Returns:
Returns the escapeBackslash.

Definition at line 2273 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.PreparedStatement.doEscapeProcessing(), and org.objectweb.cjdbc.driver.PreparedStatement.setString().

02274   {
02275     return escapeBackslash;
02276   }

boolean org.objectweb.cjdbc.driver.Connection.isEscapeSingleQuote  ) 
 

Returns the escapeSingleQuote value.

Returns:
Returns the escapeSingleQuote.

Definition at line 2293 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.PreparedStatement.doEscapeProcessing(), and org.objectweb.cjdbc.driver.PreparedStatement.setString().

02294   {
02295     return escapeSingleQuote;
02296   }

boolean org.objectweb.cjdbc.driver.Connection.isReadOnly  )  throws SQLException
 

Tests to see if the connection is in read only Mode. Note that we cannot really put the database in read only mode, but we pretend we can by returning the value of the readOnly flag.

Returns:
true if the connection is read only
Exceptions:
SQLException if a database access error occurs

Definition at line 617 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.DatabaseMetaData.isReadOnly().

00618   {
00619     return readOnly;
00620   }

String org.objectweb.cjdbc.driver.Connection.nativeSQL String  query  )  throws SQLException
 

As we can't know for sure which database will execute this request (now or later), we can't translate it in the native query language of the underlying DBMS. Therefore the query is returned unchanged.

Parameters:
query the query to change
Returns:
the original query
Exceptions:
SQLException never

Definition at line 631 of file Connection.java.

00632   {
00633     return query;
00634   }

java.sql.CallableStatement org.objectweb.cjdbc.driver.Connection.prepareCall String  sql,
int  resultSetType,
int  resultSetConcurrency,
int  resultSetHoldability
throws SQLException
 

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareCall method above, but it allows the default result set type, result set concurrency type and holdability to be overridden.

Parameters:
sql a String object that is the SQL statement to be sent to the database; may contain on or more ? parameters
resultSetType one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetHoldability one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Returns:
a new CallableStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
Exceptions:
SQLException if a database access error occurs or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
See also:
ResultSet
Since:
JDK 1.4

Definition at line 1876 of file Connection.java.

01878   {
01879     throw new NotImplementedException("prepareCall");
01880   }

java.sql.CallableStatement org.objectweb.cjdbc.driver.Connection.prepareCall String  sql,
int  resultSetType,
int  resultSetConcurrency
throws SQLException
 

Stored procedure call are not yet supported by C-JDBC.

Parameters:
sql a String value
resultSetType an int value
resultSetConcurrency an int value
Returns:
nothing
Exceptions:
SQLException not supported

Definition at line 659 of file Connection.java.

References org.objectweb.cjdbc.driver.Statement.setResultSetConcurrency(), and org.objectweb.cjdbc.driver.Statement.setResultSetType().

00661   {
00662     CallableStatement c = new CallableStatement(this, sql);
00663     c.setResultSetType(resultSetType);
00664     c.setResultSetConcurrency(resultSetConcurrency);
00665     return c;
00666   }

java.sql.CallableStatement org.objectweb.cjdbc.driver.Connection.prepareCall String  sql  )  throws SQLException
 

Creates a CallableStatement that contains sql and produces a ResultSet that is TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY.

Parameters:
sql SQL request
Returns:
nothing
Exceptions:
SQLException not supported

Definition at line 644 of file Connection.java.

00645   {
00646     return prepareCall(sql, java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,
00647         java.sql.ResultSet.CONCUR_READ_ONLY);
00648   }

java.sql.PreparedStatement org.objectweb.cjdbc.driver.Connection.prepareStatement String  sql,
String  columnNames[]
throws SQLException
 

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. This array is ignored if the SQL statement is not an INSERT statement.

An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

Parameters:
sql an SQL statement that may contain one or more '?' IN parameter placeholders
columnNames an array of column names indicating the columns that should be returned from the inserted row or rows
Returns:
a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names
Exceptions:
SQLException if a database access error occurs
Since:
JDK 1.4

Definition at line 1998 of file Connection.java.

02000   {
02001     throw new NotImplementedException("prepareStatement");
02002   }

java.sql.PreparedStatement org.objectweb.cjdbc.driver.Connection.prepareStatement String  sql,
int  columnIndexes[]
throws SQLException
 

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. This array is ignored if the SQL statement is not an INSERT statement.

An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

Parameters:
sql an SQL statement that may contain one or more '?' IN parameter placeholders
columnIndexes an array of column indexes indicating the columns that should be returned from the inserted row or rows
Returns:
a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes
Exceptions:
SQLException if a database access error occurs
Since:
JDK 1.4

Definition at line 1958 of file Connection.java.

01960   {
01961     throw new NotImplementedException("prepareStatement");
01962   }

java.sql.PreparedStatement org.objectweb.cjdbc.driver.Connection.prepareStatement String  sql,
int  autoGeneratedKeys
throws SQLException
 

Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an INSERT statement.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

Parameters:
sql an SQL statement that may contain one or more '?' IN parameter placeholders
autoGeneratedKeys a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
Returns:
a new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys
Exceptions:
SQLException if a database access error occurs or the given parameter is not a Statement constant indicating whether auto-generated keys should be returned
Since:
JDK 1.4

Definition at line 1916 of file Connection.java.

References org.objectweb.cjdbc.driver.PreparedStatement.setGeneratedKeysFlag().

01918   {
01919     PreparedStatement ps = new PreparedStatement(this, sql);
01920     ps.setGeneratedKeysFlag(autoGeneratedKeys);
01921     return ps;
01922   }

java.sql.PreparedStatement org.objectweb.cjdbc.driver.Connection.prepareStatement String  sql,
int  resultSetType,
int  resultSetConcurrency,
int  resultSetHoldability
throws SQLException
 

Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.

This method is the same as the prepareStatement method above, but it allows the default result set type, concurrency, and holdability to be overridden.

Parameters:
sql a String object that is the SQL statement to be sent to the database; may contain one or more ? IN parameters
resultSetType one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetHoldability one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Returns:
a new PreparedStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
Exceptions:
SQLException if a database access error occurs or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
See also:
ResultSet
Since:
JDK 1.4

Definition at line 1840 of file Connection.java.

01843   {
01844     throw new NotImplementedException("prepareStatement");
01845   }

java.sql.PreparedStatement org.objectweb.cjdbc.driver.Connection.prepareStatement String  sql,
int  resultSetType,
int  resultSetConcurrency
throws SQLException
 

A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Parameters:
sql a SQL statement that may contain one or more '?' IN
resultSetType ResultSetType to use
resultSetConcurrency ResultSetConcurrency to use
Returns:
a new PreparedStatement object
Exceptions:
SQLException passed through from the constructor

Definition at line 696 of file Connection.java.

References org.objectweb.cjdbc.driver.Statement.setResultSetConcurrency(), and org.objectweb.cjdbc.driver.Statement.setResultSetType().

00698   {
00699     PreparedStatement s = new PreparedStatement(this, sql);
00700     s.setResultSetType(resultSetType);
00701     s.setResultSetConcurrency(resultSetConcurrency);
00702     return s;
00703   }

java.sql.PreparedStatement org.objectweb.cjdbc.driver.Connection.prepareStatement String  sql  )  throws SQLException
 

A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Parameters:
sql a SQL statement that may contain one or more '?' IN * parameter placeholders
Returns:
a new PreparedStatement object containing the pre-compiled statement.
Exceptions:
SQLException if a database access error occurs.

Definition at line 679 of file Connection.java.

00681   {
00682     return new PreparedStatement(this, sql);
00683   }

void org.objectweb.cjdbc.driver.Connection.releaseSavepoint Savepoint  savepoint  )  throws SQLException
 

Removes the given Savepoint object from the current transaction. Any reference to the savepoint after it have been removed will cause an SQLException to be thrown.

Parameters:
savepoint the Savepoint object to be removed
Exceptions:
SQLException if a database access error occurs or the given Savepoint object is not a valid savepoint in the current transaction
Since:
JDK 1.4

Definition at line 1770 of file Connection.java.

01771   {
01772     throw new NotImplementedException("releaseSavepoint");
01773   }

void org.objectweb.cjdbc.driver.Connection.rollback Savepoint  savepoint  )  throws SQLException
 

Undoes all changes made after the given Savepoint object was set.

This method should be used only when auto-commit has been disabled.

Parameters:
savepoint the Savepoint object to roll back to
Exceptions:
SQLException if a database access error occurs, the Savepoint object is no longer valid, or this Connection object is currently in auto-commit mode
See also:
Savepoint

rollback()

Since:
JDK 1.4

Definition at line 1754 of file Connection.java.

01755   {
01756     throw new NotImplementedException("rollback");
01757   }

void org.objectweb.cjdbc.driver.Connection.rollback  )  throws SQLException
 

Drops all changes made since the previous commit/rollback and releases any database locks currently held by this connection. If the connection was in autocommit mode, we throw a SQLException.

Exceptions:
SQLException if a database access error occurs or the connection is in autocommit mode
See also:
Connection.commit

Definition at line 714 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, org.objectweb.cjdbc.driver.Connection.transactionId, and org.objectweb.cjdbc.driver.Connection.writeExecutedInTransaction.

Referenced by org.objectweb.cjdbc.driver.Connection.finalize().

00715   {
00716     if (autoCommit)
00717       throw new SQLException(
00718           "Trying to rollback a connection in autocommit mode");
00719 
00720     if (driver == null)
00721       throw new SQLException("No driver to send the rollback request");
00722 
00723     try
00724     {
00725       socketOutput.writeInt(Commands.Rollback);
00726       socketOutput.flush();
00727       // Rollback is followed by a BEGIN
00728       writeExecutedInTransaction = false;
00729       Object r = socketInput.readObject();
00730       if (r instanceof Long)
00731         transactionId = ((Long) r).longValue();
00732       else
00733         throw new SQLException(
00734             "Error occured while trying to start transaction after rollback on C-JDBC Controller ("
00735                 + r + ")");
00736     }
00737     catch (Exception e)
00738     {
00739       throw new SQLException("Error occured while rollback of transaction '"
00740           + transactionId + "' was processed by C-JDBC Controller (" + e + ")");
00741     }
00742   }

void org.objectweb.cjdbc.driver.Connection.setAutoCommit boolean  autoCommit  )  throws SQLException
 

If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit()or rollback(). By default, new connections are in auto-commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.

Parameters:
autoCommit true enables auto-commit; false disables it
Exceptions:
SQLException if a database access error occurs

Definition at line 762 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, org.objectweb.cjdbc.driver.Connection.transactionId, and org.objectweb.cjdbc.driver.Connection.writeExecutedInTransaction.

00763   {
00764     if (this.autoCommit == autoCommit)
00765       return;
00766 
00767     this.autoCommit = autoCommit;
00768     if (driver == null)
00769       throw new SQLException("No driver to get a transaction id");
00770 
00771     if (autoCommit)
00772     {
00773       transactionId = 0;
00774       try
00775       {
00776         socketOutput.writeInt(Commands.SetAutoCommit);
00777         socketOutput.flush();
00778         Object r = socketInput.readObject();
00779         writeExecutedInTransaction = false;
00780         if (r instanceof Boolean || ((Boolean) r).booleanValue())
00781           return;
00782         else
00783           throw new SQLException(
00784               "Error occured while trying to change autocommit value on C-JDBC Controller ("
00785                   + r + ")");
00786       }
00787       catch (Exception e)
00788       {
00789         throw new SQLException(
00790             "Error occured while trying to change autocommit value on C-JDBC Controller ("
00791                 + e + ")");
00792       }
00793     }
00794     else
00795     {
00796 
00797       try
00798       {
00799         socketOutput.writeInt(Commands.Begin);
00800         socketOutput.flush();
00801         Object r = socketInput.readObject();
00802         if (r instanceof Long)
00803           transactionId = ((Long) r).longValue();
00804         else
00805           throw new SQLException(
00806               "Error occured while trying to start transaction on C-JDBC Controller ("
00807                   + r + ")");
00808         this.autoCommit = false;
00809       }
00810       catch (Exception e)
00811       {
00812         throw new SQLException(
00813             "Error occured while trying to start transaction on C-JDBC Controller ("
00814                 + e + ")");
00815       }
00816     }
00817   }

void org.objectweb.cjdbc.driver.Connection.setCatalog String  catalog  )  throws SQLException
 

Change the current catalog

Parameters:
catalog a String value
Exceptions:
SQLException if fails or if catalog name is invalid

Definition at line 825 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.driver, org.objectweb.cjdbc.driver.Driver.getUrlFromProperties(), org.objectweb.cjdbc.driver.Driver.parseURL(), org.objectweb.cjdbc.driver.Connection.socketInput, org.objectweb.cjdbc.driver.Connection.socketOutput, and org.objectweb.cjdbc.driver.Connection.url.

00826   {
00827     if (catalog == null)
00828       throw new SQLException("Invalid Catalog");
00829     Hashtable properties = driver.parseURL(url);
00830     properties.put(Driver.DATABASE_PROPERTY, catalog);
00831     url = driver.getUrlFromProperties(properties);
00832 
00833     if (driver == null)
00834       throw new SQLException("No driver to set the catalog.");
00835     try
00836     {
00837       socketOutput.writeInt(Commands.ConnectionSetCatalog);
00838       socketOutput.writeUTF(catalog);
00839       socketOutput.flush();
00840 
00841       Object rs = socketInput.readObject();
00842       if (rs instanceof Boolean)
00843       {
00844         if (((Boolean) rs).booleanValue() == false)
00845           throw new SQLException("Invalid Catalog");
00846       }
00847       else
00848         throw new SQLException("Connection.setCatalog: Unexpected response ("
00849             + rs + ")");
00850     }
00851     catch (Exception e)
00852     {
00853       throw new SQLException(
00854           "Connection.setCatalog: Error occured while request was processed by C-JDBC Controller ("
00855               + e + ")");
00856     }
00857   }

void org.objectweb.cjdbc.driver.Connection.setCloseSocketOnGC boolean  closeSocketOnGC  )  [protected]
 

Sets the closeSocketOnGC value.

Parameters:
closeSocketOnGC The closeSocketOnGC to set.

Definition at line 1109 of file Connection.java.

01110   {
01111     this.closeSocketOnGC = closeSocketOnGC;
01112   }

void org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest AbstractRequest  request  )  [protected]
 

Set the autocommit mode and read-only status on this request.

Parameters:
request The request to set

Definition at line 916 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.autoCommit, org.objectweb.cjdbc.driver.Connection.readOnly, org.objectweb.cjdbc.common.sql.AbstractRequest.setDriverProcessed(), org.objectweb.cjdbc.common.sql.AbstractRequest.setIsAutoCommit(), and org.objectweb.cjdbc.common.sql.AbstractRequest.setIsReadOnly().

Referenced by org.objectweb.cjdbc.driver.Connection.execReadRequest(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.execWriteRequest(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), and org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure().

00917   {
00918     request.setIsAutoCommit(autoCommit);
00919     request.setIsReadOnly(readOnly);
00920     request.setDriverProcessed(driverProcessed);
00921   }

void org.objectweb.cjdbc.driver.Connection.setDriverProcessed boolean  processedByDriver  ) 
 

Sets the driverProcessed value

Parameters:
processedByDriver true if the PreparedStatement are processed by the C-JDBC driver.

Definition at line 2314 of file Connection.java.

02315   {
02316     this.driverProcessed = processedByDriver;
02317   }

void org.objectweb.cjdbc.driver.Connection.setEscapeBackslash boolean  escapeBackslash  ) 
 

Sets the escapeBackslash value.

Parameters:
escapeBackslash The escapeBackslash to set.

Definition at line 2283 of file Connection.java.

02284   {
02285     this.escapeBackslash = escapeBackslash;
02286   }

void org.objectweb.cjdbc.driver.Connection.setEscapeChar String  escapeChar  ) 
 

Sets the escapeCharacter value

Parameters:
escapeChar the escapeChar value to set

Definition at line 2334 of file Connection.java.

02335   {
02336     this.escapeChar = escapeChar;
02337   }

void org.objectweb.cjdbc.driver.Connection.setEscapeSingleQuote boolean  escapeSingleQuote  ) 
 

Sets the escapeSingleQuote value.

Parameters:
escapeSingleQuote The escapeSingleQuote to set.

Definition at line 2303 of file Connection.java.

02304   {
02305     this.escapeSingleQuote = escapeSingleQuote;
02306   }

void org.objectweb.cjdbc.driver.Connection.setHoldability int  holdability  )  throws SQLException
 

Changes the holdability of ResultSet objects created using this Connection object to the given holdability.

Parameters:
holdability a ResultSet holdability constant; one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Exceptions:
SQLException if a database access occurs, the given parameter is not a ResultSet constant indicating holdability, or the given holdability is not supported
See also:
getHoldability

ResultSet

Since:
JDK 1.4

Definition at line 1684 of file Connection.java.

01685   {
01686     throw new NotImplementedException("setHoldability");
01687   }

void org.objectweb.cjdbc.driver.Connection.setPreparedStatementBooleanFalse String  booleanFalse  ) 
 

Sets the booleanFalse value.

Parameters:
booleanFalse The booleanFalse to set.

Definition at line 2243 of file Connection.java.

02244   {
02245     this.preparedStatementBooleanFalse = booleanFalse;
02246   }

void org.objectweb.cjdbc.driver.Connection.setPreparedStatementBooleanTrue String  booleanTrue  ) 
 

Sets the booleanTrue value.

Parameters:
booleanTrue The booleanTrue to set.

Definition at line 2263 of file Connection.java.

02264   {
02265     this.preparedStatementBooleanTrue = booleanTrue;
02266   }

void org.objectweb.cjdbc.driver.Connection.setReadOnly boolean  readOnly  )  throws SQLException
 

You can put a connection in read-only mode as a hint to enable database optimizations

Note: setReadOnly cannot be called while in the middle of a transaction with write requests.

Parameters:
readOnly true enables read-only mode; false disables it
Exceptions:
SQLException if a database access error occurs

Definition at line 870 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.autoCommit.

00871   {
00872     if ((autoCommit == false) && writeExecutedInTransaction)
00873       throw new SQLException(
00874           "setReadOnly cannot be called in a transaction that has executed write requests.");
00875 
00876     this.readOnly = readOnly;
00877   }

Savepoint org.objectweb.cjdbc.driver.Connection.setSavepoint String  name  )  throws SQLException
 

Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.

Parameters:
name a String containing the name of the savepoint
Returns:
the new Savepoint object
Exceptions:
SQLException if a database access error occurs or this Connection object is currently in auto-commit mode
See also:
Savepoint
Since:
JDK 1.4

Definition at line 1734 of file Connection.java.

01735   {
01736     throw new NotImplementedException("setSavepoint");
01737   }

Savepoint org.objectweb.cjdbc.driver.Connection.setSavepoint  )  throws SQLException
 

Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.

Returns:
the new Savepoint object
Exceptions:
SQLException if a database access error occurs or this Connection object is currently in auto-commit mode
See also:
Savepoint
Since:
JDK 1.4

Definition at line 1717 of file Connection.java.

01718   {
01719     throw new NotImplementedException("setSavepoint");
01720   }

void org.objectweb.cjdbc.driver.Connection.setTransactionIsolation int  level  )  throws SQLException
 

You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.

Note: this method cannot be called while in the middle of a transaction.

Parameters:
level one of the TRANSACTION_* isolation values with * the exception of TRANSACTION_NONE; some databases may * not support other values
Exceptions:
SQLException if a database access error occurs
See also:
java.sql.DatabaseMetaData#supportsTransactionIsolationLevel

Definition at line 891 of file Connection.java.

References org.objectweb.cjdbc.driver.Connection.isolationLevel.

00892   {
00893     isolationLevel = level;
00894   }

void org.objectweb.cjdbc.driver.Connection.setTypeMap java.util.Map  map  )  throws SQLException
 

C-JDBC does NOT support type map.

Parameters:
map ignored
Exceptions:
SQLException not supported

Definition at line 902 of file Connection.java.

00903   {
00904     throw new NotImplementedException("setTypeMap()");
00905   }


Member Data Documentation

boolean org.objectweb.cjdbc.driver.Connection.autoCommit = true [protected]
 

Commit mode of the connection (true= automatic).

Definition at line 72 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest(), and org.objectweb.cjdbc.driver.Connection.setReadOnly().

Driver org.objectweb.cjdbc.driver.Connection.driver = null [protected]
 

Driver that created us.

Definition at line 99 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Connection.commit(), org.objectweb.cjdbc.driver.Connection.execReadRequest(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.execWriteRequest(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure(), org.objectweb.cjdbc.driver.Connection.getCatalog(), org.objectweb.cjdbc.driver.Connection.getCatalogs(), org.objectweb.cjdbc.driver.Connection.getPrimaryKeys(), org.objectweb.cjdbc.driver.Connection.getSchemas(), org.objectweb.cjdbc.driver.Connection.getTablePrivileges(), org.objectweb.cjdbc.driver.Connection.getTables(), org.objectweb.cjdbc.driver.Connection.getTableTypes(), org.objectweb.cjdbc.driver.Connection.rollback(), org.objectweb.cjdbc.driver.Connection.setAutoCommit(), and org.objectweb.cjdbc.driver.Connection.setCatalog().

final String org.objectweb.cjdbc.driver.Connection.END_PARAM_TAG = "|" + TAG_MARKER + ">" [static]
 

Tag for PreparedStatement parameters end delimiter

Definition at line 138 of file Connection.java.

SQLWarning org.objectweb.cjdbc.driver.Connection.firstWarning = null [protected]
 

List of Warnings for this connection.

Definition at line 93 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.clearWarnings().

boolean org.objectweb.cjdbc.driver.Connection.isClosed = false [protected]
 

Status of the connection.

Definition at line 75 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.close(), and org.objectweb.cjdbc.driver.Driver.connect().

int org.objectweb.cjdbc.driver.Connection.isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED [protected]
 

Isolation level.

Definition at line 84 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.setTransactionIsolation().

final String org.objectweb.cjdbc.driver.Connection.LINE_SEPARATOR [static, protected]
 

Initial value:

 System
      .getProperty("line.separator")

Definition at line 146 of file Connection.java.

DatabaseMetaData org.objectweb.cjdbc.driver.Connection.metaData = null [protected]
 

Meta-data of C-JDBC connections.

Definition at line 96 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.getMetaData().

boolean org.objectweb.cjdbc.driver.Connection.needSqlSkeleton = false [protected]
 

Does the controller require the SQL skeleton?

Definition at line 90 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Statement.executeQuery(), and org.objectweb.cjdbc.driver.Statement.executeUpdateWithSkeleton().

boolean org.objectweb.cjdbc.driver.Connection.readOnly = false [protected]
 

Is the connection in read-only mode ?

Definition at line 78 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.close(), and org.objectweb.cjdbc.driver.Connection.setConnectionParametersOnRequest().

Socket org.objectweb.cjdbc.driver.Connection.socket [protected]
 

Connection with the controller.

Definition at line 109 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.getConnectedController().

CJDBCInputStream org.objectweb.cjdbc.driver.Connection.socketInput [protected]
 

Socket input stream.

Definition at line 112 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.closeRemoteResultSet(), org.objectweb.cjdbc.driver.Connection.commit(), org.objectweb.cjdbc.driver.Connection.execReadRequest(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.execWriteRequest(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure(), org.objectweb.cjdbc.driver.Connection.fetchNextData(), org.objectweb.cjdbc.driver.Connection.getCatalog(), org.objectweb.cjdbc.driver.Connection.getCatalogs(), org.objectweb.cjdbc.driver.Connection.getControllerVersionNumber(), org.objectweb.cjdbc.driver.Connection.getDatabaseProductName(), org.objectweb.cjdbc.driver.Connection.getPrimaryKeys(), org.objectweb.cjdbc.driver.Connection.getSchemas(), org.objectweb.cjdbc.driver.Connection.getStaticMetadata(), org.objectweb.cjdbc.driver.Connection.getTablePrivileges(), org.objectweb.cjdbc.driver.Connection.getTables(), org.objectweb.cjdbc.driver.Connection.getTableTypes(), org.objectweb.cjdbc.driver.Connection.rollback(), org.objectweb.cjdbc.driver.Connection.setAutoCommit(), and org.objectweb.cjdbc.driver.Connection.setCatalog().

CJDBCOutputStream org.objectweb.cjdbc.driver.Connection.socketOutput [protected]
 

Socket output stream.

Definition at line 115 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.close(), org.objectweb.cjdbc.driver.Connection.closeRemoteResultSet(), org.objectweb.cjdbc.driver.Connection.commit(), org.objectweb.cjdbc.driver.Connection.execReadRequest(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.execWriteRequest(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure(), org.objectweb.cjdbc.driver.Connection.fetchNextData(), org.objectweb.cjdbc.driver.Connection.getCatalog(), org.objectweb.cjdbc.driver.Connection.getCatalogs(), org.objectweb.cjdbc.driver.Connection.getControllerVersionNumber(), org.objectweb.cjdbc.driver.Connection.getDatabaseProductName(), org.objectweb.cjdbc.driver.Connection.getPrimaryKeys(), org.objectweb.cjdbc.driver.Connection.getSchemas(), org.objectweb.cjdbc.driver.Connection.getStaticMetadata(), org.objectweb.cjdbc.driver.Connection.getTablePrivileges(), org.objectweb.cjdbc.driver.Connection.getTables(), org.objectweb.cjdbc.driver.Connection.getTableTypes(), org.objectweb.cjdbc.driver.Connection.rollback(), org.objectweb.cjdbc.driver.Connection.setAutoCommit(), and org.objectweb.cjdbc.driver.Connection.setCatalog().

final String org.objectweb.cjdbc.driver.Connection.START_PARAM_TAG = "<" + TAG_MARKER [static]
 

Tag for PreparedStatement parameters start delimiter

Definition at line 136 of file Connection.java.

final String org.objectweb.cjdbc.driver.Connection.TAG_MARKER = "!%" [static]
 

Tag maker for PreparedStatement parameters

Definition at line 132 of file Connection.java.

final String org.objectweb.cjdbc.driver.Connection.TAG_MARKER_ESCAPE = TAG_MARKER + ";" [static]
 

Escape for tag maker

Definition at line 134 of file Connection.java.

long org.objectweb.cjdbc.driver.Connection.transactionId = 0 [protected]
 

transaction identifier.

Definition at line 87 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.commit(), org.objectweb.cjdbc.driver.Connection.rollback(), and org.objectweb.cjdbc.driver.Connection.setAutoCommit().

String org.objectweb.cjdbc.driver.Connection.url = null [protected]
 

C-JDBC URL of the database.

Definition at line 102 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.setCatalog().

String org.objectweb.cjdbc.driver.Connection.vdbUser = null [protected]
 

Virtual database user used for this connection.

Definition at line 105 of file Connection.java.

boolean org.objectweb.cjdbc.driver.Connection.writeExecutedInTransaction = false [package]
 

Has a write request been executed in the current transaction?

Definition at line 81 of file Connection.java.

Referenced by org.objectweb.cjdbc.driver.Connection.commit(), org.objectweb.cjdbc.driver.Connection.rollback(), and org.objectweb.cjdbc.driver.Connection.setAutoCommit().


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:04:55 2005 for C-JDBC by  doxygen 1.3.9.1