|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.driver.Connection
This class implements the communication protocol to the Controller.
Connection.java was inspired from the PostgreSQL JDBC driver by Peter T. Mount.
| Field Summary | |
protected boolean |
autoCommit
Commit mode of the connection ( true= automatic). |
private AbstractBlobFilter |
blobFilter
|
private CjdbcUrl |
cjdbcUrl
Parsed URL to the database. |
private boolean |
closeSocketOnGC
|
private boolean |
connectionPooling
|
protected ControllerInfo |
controllerInfo
C-JDBC controller we are connected to |
protected boolean |
controllerNeedsSqlSkeleton
Does the controller wants SQL templates of PreparedStatements? |
static int |
DEFAULT_TRANSACTION_ISOLATION_LEVEL
Default transaction isolation level if the user has not enforced one |
protected Driver |
driver
Driver that created us. |
protected boolean |
driverProcessed
|
protected boolean |
escapeBackslash
|
protected java.lang.String |
escapeChar
|
protected boolean |
escapeSingleQuote
|
protected java.sql.SQLWarning |
firstWarning
List of Warnings for this connection. |
protected boolean |
isClosed
Status of the connection. |
protected int |
isolationLevel
Current transaction isolation level. |
(package private) static java.lang.String |
LINE_SEPARATOR
|
protected DatabaseMetaData |
metaData
Meta-data of C-JDBC connections. |
protected java.lang.String |
preparedStatementBooleanFalse
|
protected java.lang.String |
preparedStatementBooleanTrue
|
protected boolean |
readOnly
Is the connection in read-only mode ? |
protected java.net.Socket |
socket
Connection with the controller. |
protected CJDBCInputStream |
socketInput
Socket input stream. |
protected CJDBCOutputStream |
socketOutput
Socket output stream. |
protected long |
transactionId
transaction identifier. |
protected java.lang.String |
vdbPassword
|
protected java.lang.String |
vdbUser
Virtual database user used for this connection. |
(package private) boolean |
writeExecutedInTransaction
Has a write request been executed in the current transaction? |
| Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
Connection(Driver driver,
java.net.Socket socket,
CJDBCInputStream in,
CJDBCOutputStream out,
CjdbcUrl cjdbcUrl,
ControllerInfo controller,
java.lang.String userName,
java.lang.String password)
Creates a new Connection instance. |
|
| Method Summary | |
void |
clearWarnings()
After this call, getWarnings() returns null
until a new warning is reported for this connection. |
void |
close()
Releases the connection. |
void |
closeRemoteResultSet(java.lang.String cursorName)
Closes the remote ResultSet given its cursor name. |
void |
commit()
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.
|
java.sql.Statement |
createStatement()
SQL statements without parameters are normally executed using Statement objects. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
SQL statements without parameters are normally executed using Statement objects. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates a Statement object that will generate
ResultSet objects with the given type, concurrency, and
holdability.
|
protected java.sql.ResultSet |
execReadRequest(SelectRequest request)
Performs a read request and return the reply. |
java.sql.ResultSet |
execReadStoredProcedure(StoredProcedure proc)
Call a stored procedure that returns a ResultSet. |
protected int |
execWriteRequest(AbstractWriteRequest request)
Performs a write request and return the number of rows affected. |
protected java.sql.ResultSet |
execWriteRequestWithKeys(AbstractWriteRequest request)
Performs a write request and returns the auto-generated keys |
protected int |
execWriteStoredProcedure(StoredProcedure proc)
Call a stored procedure that performs an update. |
void |
fetchNextData(java.lang.String cursorName,
int fetchSize,
DriverResultSet drsToUpdate)
Fetch next fetchSize rows of data and update the given ResultSet. |
protected void |
finalize()
|
protected java.sql.ResultSet |
getAttributes(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String typeNamePattern,
java.lang.String attributeNamePattern)
|
boolean |
getAutoCommit()
Gets the current auto-commit state. |
protected java.sql.ResultSet |
getBestRowIdentifier(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
int scope,
boolean nullable)
|
(package private) AbstractBlobFilter |
getBlobFilter()
|
java.lang.String |
getCatalog()
Return current catalog name. |
java.sql.ResultSet |
getCatalogs()
getCatalogs definition. |
protected java.sql.ResultSet |
getColumnPrivileges(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableName,
java.lang.String columnNamePattern)
|
protected java.sql.ResultSet |
getColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String columnNamePattern)
|
ControllerInfo |
getControllerInfo()
Get the information about the controller we are connected to |
java.lang.String |
getControllerVersionNumber()
Get the C-JDBC controller version number. |
protected java.sql.ResultSet |
getCrossReference(java.lang.String primaryCatalog,
java.lang.String primarySchema,
java.lang.String primaryTable,
java.lang.String foreignCatalog,
java.lang.String foreignSchema,
java.lang.String foreignTable)
|
java.lang.String |
getDatabaseProductName()
|
java.lang.String |
getEscapeChar()
|
java.sql.ResultSet |
getExportedKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
|
int |
getHoldability()
Retrieves the current holdability of ResultSet objects
created using this Connection object. |
protected java.sql.ResultSet |
getImportedKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
|
protected java.sql.ResultSet |
getIndexInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
boolean unique,
boolean approximate)
|
java.sql.DatabaseMetaData |
getMetaData()
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. |
java.lang.String |
getPassword()
Gets the password used to login to the database. |
java.lang.String |
getPreparedStatementBooleanFalse()
Returns the booleanFalse value. |
java.lang.String |
getPreparedStatementBooleanTrue()
Returns the booleanTrue value. |
protected java.sql.ResultSet |
getPrimaryKeys(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern)
|
protected java.sql.ResultSet |
getProcedureColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern,
java.lang.String columnNamePattern)
|
protected java.sql.ResultSet |
getProcedures(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern)
|
java.sql.ResultSet |
getSchemas()
|
(package private) java.lang.Object |
getStaticMetadata(java.lang.String key)
Retrieve a static metadata from the controller. |
protected java.sql.ResultSet |
getSuperTables(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern)
|
protected java.sql.ResultSet |
getSuperTypes(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String typeNamePattern)
|
java.sql.ResultSet |
getTablePrivileges(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern)
Gets a description of the access rights for each table available in a catalog. |
protected java.sql.ResultSet |
getTables(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String[] types)
|
java.sql.ResultSet |
getTableTypes()
Gets the table types available in this database. |
int |
getTransactionIsolation()
Gets this Connection's current transaction isolation mode. |
protected java.sql.ResultSet |
getTypeInfo()
|
java.util.Map |
getTypeMap()
C-JDBC does NOT support type map. |
protected java.sql.ResultSet |
getUDTs(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String typeNamePattern,
int[] types)
|
java.lang.String |
getUrl()
Gets the C-JDBC URL of the database of the connection. |
java.lang.String |
getUserName()
Gets the user name used to login to the database. |
java.sql.ResultSet |
getVersionColumns(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
|
java.sql.SQLWarning |
getWarnings()
The first warning reported by calls on this connection is returned. |
boolean |
isClosed()
Returns true if the connection has been closed by the user
(but C-JDBC may leave it open underneath, unknown to the user). |
boolean |
isConnectionPooling()
Returns the connectionPooling value. |
(package private) boolean |
isDriverProcessed()
|
boolean |
isEscapeBackslash()
Returns the escapeBackslash value. |
boolean |
isEscapeSingleQuote()
Returns the escapeSingleQuote value. |
boolean |
isReadOnly()
Tests to see if the connection is in read only Mode. |
java.lang.String |
nativeSQL(java.lang.String query)
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. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Creates a CallableStatement that contains sql and produces a ResultSet that is TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Stored procedure call are not yet supported by C-JDBC. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates a CallableStatement object that will generate
ResultSet objects with the given type and concurrency. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
A SQL statement with or without IN parameters can be
pre-compiled and stored in a PreparedStatement object. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
Creates a default PreparedStatement object that has the
capability to retrieve auto-generated keys. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes)
Creates a default PreparedStatement object capable of
returning the auto-generated keys designated by the given array. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates a PreparedStatement object that will generate
ResultSet objects with the given type, concurrency, and
holdability.
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
Creates a default PreparedStatement object capable of
returning the auto-generated keys designated by the given array. |
private void |
procedureOnStream(StoredProcedure proc,
boolean isRead)
Serialize a procedure on the output stream by sending only the needed parameters to reconstruct it on the controller |
private boolean |
receiveBoolean()
Returns a boolean read from the stream or throws the SerializableException that came instead. |
private SerializableException |
receiveException()
Deserialize an exception from the stream: converts explicit protocol typing into java types. |
private int |
receiveInt()
Returns a int read from the stream or throws the SerializableException that came instead. |
private long |
receiveLong()
Returns a long read from the stream or throws the SerializableException that came instead. |
private DriverResultSet |
receiveResultSet(java.lang.String callerName)
Returns a DriverResultSet read from the stream or throws the SerializableException that came instead |
private java.lang.String |
receiveString()
Returns a String read from the stream or throws the SerializableException that came instead. |
private void |
reconnect()
Try first to reconnect to the same controller and if we don't succeed then we notify the suspicion of failure if the current controller and we reconnect to a controller chosen using the policy specified in the JDBC URL of this connection. |
void |
releaseSavepoint(java.sql.Savepoint savepoint)
Removes the given Savepoint object from the current
transaction. |
void |
rollback()
Drops all changes made since the previous commit/rollback and releases any database locks currently held by this connection. |
void |
rollback(java.sql.Savepoint savepoint)
Undoes all changes made after the given Savepoint object was
set.
|
private void |
savepointOnStream(java.sql.Savepoint savepoint)
Serialize a savepoint on the output stream by sending only the needed parameters to reconstruct it on the controller |
void |
setAutoCommit(boolean autoCommit)
If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. |
void |
setCatalog(java.lang.String catalog)
Change the current catalog |
private void |
setCloseSocketOnGC(boolean closeSocketOnGC)
Sets the closeSocketOnGC value. |
private void |
setConnectionParametersOnRequest(AbstractRequest request)
Set the autocommit mode and read-only status on this request. |
void |
setConnectionPooling(boolean connectionPooling)
Sets the connectionPooling value. |
(package private) void |
setDriverProcessed(boolean processedByDriver)
Sets the driverProcessed value |
void |
setEscapeBackslash(boolean escapeBackslash)
Sets the escapeBackslash value. |
void |
setEscapeChar(java.lang.String escapeChar)
Sets the escapeCharacter value |
void |
setEscapeSingleQuote(boolean escapeSingleQuote)
Sets the escapeSingleQuote value. |
void |
setHoldability(int holdability)
Changes the holdability of ResultSet objects created using
this Connection object to the given holdability. |
void |
setPreparedStatementBooleanFalse(java.lang.String booleanFalse)
Sets the booleanFalse value. |
void |
setPreparedStatementBooleanTrue(java.lang.String booleanTrue)
Sets the booleanTrue value. |
void |
setReadOnly(boolean readOnly)
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. |
java.sql.Savepoint |
setSavepoint()
Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it. |
java.sql.Savepoint |
setSavepoint(java.lang.String name)
Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it. |
void |
setTransactionIsolation(int level)
You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values. |
void |
setTypeMap(java.util.Map map)
C-JDBC does NOT support type map. |
private void |
setUrlParametersOptionsOnConnection(CjdbcUrl cjdbcUrl)
Set CjdbcUrl parameters options on connection. |
private void |
throwSQLExceptionIfClosed()
|
private void |
throwSQLExceptionIfClosed(java.lang.String message)
|
java.lang.String |
toString()
|
private DriverSQLException |
wrapIOExceptionInDriverSQLException(java.lang.String callerName,
java.io.IOException ioe)
|
private void |
writeRequestOnStream(AbstractWriteRequest request)
Serialize a write request on the output stream by sending only the needed parameters to reconstruct it on the controller |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected boolean controllerNeedsSqlSkeleton
protected boolean isClosed
protected java.lang.String escapeChar
protected ControllerInfo controllerInfo
protected Driver driver
protected java.net.Socket socket
protected CJDBCInputStream socketInput
protected CJDBCOutputStream socketOutput
static final java.lang.String LINE_SEPARATOR
protected boolean autoCommit
true= automatic).
protected boolean readOnly
boolean writeExecutedInTransaction
public static final int DEFAULT_TRANSACTION_ISOLATION_LEVEL
protected int isolationLevel
protected long transactionId
protected java.sql.SQLWarning firstWarning
Warnings for this connection.
protected DatabaseMetaData metaData
private final CjdbcUrl cjdbcUrl
protected java.lang.String vdbUser
protected java.lang.String vdbPassword
private AbstractBlobFilter blobFilter
private boolean connectionPooling
protected boolean escapeBackslash
protected boolean escapeSingleQuote
protected boolean driverProcessed
protected java.lang.String preparedStatementBooleanTrue
protected java.lang.String preparedStatementBooleanFalse
private boolean closeSocketOnGC
| Constructor Detail |
public Connection(Driver driver,
java.net.Socket socket,
CJDBCInputStream in,
CJDBCOutputStream out,
CjdbcUrl cjdbcUrl,
ControllerInfo controller,
java.lang.String userName,
java.lang.String password)
throws AuthenticationException,
java.io.IOException,
ProtocolException
Connection instance.
driver - calling driversocket - connection with the controllerin - socket input streamout - socket output streamcjdbcUrl - C-JDBC URL of the databasecontroller - controller we are connected touserName - user loginpassword - user password
AuthenticationException - login error
java.io.IOException - stream error
ProtocolException - unexpected answer| Method Detail |
private void setUrlParametersOptionsOnConnection(CjdbcUrl cjdbcUrl)
cjdbcUrl - the C-JDBC URL to use
protected void finalize()
throws java.lang.Throwable
java.lang.ThrowableObject.finalize()public java.lang.String getUrl()
public java.lang.String getUserName()
public java.lang.String getPassword()
public ControllerInfo getControllerInfo()
ControllerInfo object of the controllerpublic void clearWarnings()
getWarnings() returns null
until a new warning is reported for this connection.
clearWarnings in interface java.sql.Connection
private void throwSQLExceptionIfClosed(java.lang.String message)
throws DriverSQLException
DriverSQLExceptionclose()
private void throwSQLExceptionIfClosed()
throws DriverSQLException
DriverSQLExceptionclose()
public void close()
throws DriverSQLException
ConnectionClosingThread
if the connection has not been reused before.
close in interface java.sql.ConnectionDriverSQLException - if an error occurs
public void commit()
throws DriverSQLException
Connection.
This method should only be used when auto-commit has been disabled. (If
autoCommit== true, then we throw a
DriverSQLException).
commit in interface java.sql.ConnectionDriverSQLException - if a database access error occurs or the
connection is in autocommit modesetAutoCommit(boolean)
public java.sql.Statement createStatement()
throws DriverSQLException
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/CONCUR_READ_ONLY.
*
- Specified by:
createStatement in interface java.sql.Connection
- Returns:
- a new
Statement object
- Throws:
DriverSQLException - passed through from the constructor
public java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
Statement objects. If the same SQL statement is executed
many times, it is more efficient to use a PreparedStatement.
createStatement in interface java.sql.ConnectionresultSetType - resultSetType to useresultSetConcurrency - resultSetConcurrency to use
Statement object
java.sql.SQLException - passed through from the constructor
public boolean getAutoCommit()
throws DriverSQLException
getAutoCommit in interface java.sql.ConnectionDriverSQLException - is connection is closedsetAutoCommit(boolean)
public java.sql.DatabaseMetaData getMetaData()
throws DriverSQLException
getMetaData in interface java.sql.ConnectionDatabaseMetaData object for this connection
DriverSQLException - if connection is closed
public java.lang.String getCatalog()
throws DriverSQLException
getCatalog in interface java.sql.ConnectionVirtualDatabase
DriverSQLException - if any error occursgetCatalog()
public java.sql.ResultSet getCatalogs()
throws DriverSQLException
ResultSet
- Throws:
DriverSQLException - if fails (include ANY exception that can be thrown in the code)
protected java.sql.ResultSet getProcedures(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern)
throws DriverSQLException
DriverSQLException
protected java.sql.ResultSet getProcedureColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String procedureNamePattern,
java.lang.String columnNamePattern)
throws DriverSQLException
DriverSQLException
public int getTransactionIsolation()
throws DriverSQLException
getTransactionIsolation in interface java.sql.ConnectionTRANSACTION_* mode value
DriverSQLException - if a database access error occurssetTransactionIsolation(int)
public java.util.Map getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLException - not supportedpublic java.sql.SQLWarning getWarnings()
getWarnings in interface java.sql.Connectionpublic boolean isClosed()
true if the connection has been closed by the user
(but C-JDBC may leave it open underneath, unknown to the user).
isClosed in interface java.sql.Connectiontrue if connection has never been opened or
close() has been calledpublic boolean isReadOnly()
readOnly flag.
isReadOnly in interface java.sql.Connectiontrue if the connection is read onlypublic java.lang.String nativeSQL(java.lang.String query)
nativeSQL in interface java.sql.Connectionquery - the query to change
public java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionsql - SQL request
java.sql.SQLException - not supported
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionsql - a String valueresultSetType - an int valueresultSetConcurrency - an int value
java.sql.SQLException - not supported
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
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.
prepareStatement in interface java.sql.Connectionsql - a SQL statement that may contain one or more '?' IN * parameter
placeholders
PreparedStatement object containing the
pre-compiled statement.
java.sql.SQLException - if a database access error occurs.
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
PreparedStatement object. This object can then
be used to efficiently execute this statement multiple times.
prepareStatement in interface java.sql.Connectionsql - a SQL statement that may contain one or more '?' INresultSetType - ResultSetType to useresultSetConcurrency - ResultSetConcurrency to use
PreparedStatement object
java.sql.SQLException - passed through from the constructor
public void rollback()
throws DriverSQLException
rollback in interface java.sql.ConnectionDriverSQLException - if a database access error occurs or the
connection is in autocommit modecommit()
public void setAutoCommit(boolean autoCommit)
throws DriverSQLException
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.
setAutoCommit in interface java.sql.ConnectionautoCommit - true enables auto-commit;
false disables it
DriverSQLException - if a database access error occurs
public void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
setCatalog in interface java.sql.Connectioncatalog - a String value
java.sql.SQLException - if fails or if catalog name is invalid
public void setReadOnly(boolean readOnly)
throws DriverSQLException
Note: setReadOnly cannot be called while in the middle of a transaction with write requests.
setReadOnly in interface java.sql.ConnectionreadOnly - true enables read-only mode;
false disables it
DriverSQLException - if a database access error occurs
public void setTransactionIsolation(int level)
throws DriverSQLException
Note: this method cannot be called while in the middle of a transaction.
setTransactionIsolation in interface java.sql.Connectionlevel - one of the TRANSACTION_* isolation values with * the exception
of TRANSACTION_NONE; some databases may * not support other values
DriverSQLException - if a database access error occursDatabaseMetaData.supportsTransactionIsolationLevel(int)
public void setTypeMap(java.util.Map map)
throws java.sql.SQLException
setTypeMap in interface java.sql.Connectionmap - ignored
java.sql.SQLException - not supportedprivate void setCloseSocketOnGC(boolean closeSocketOnGC)
closeSocketOnGC - The closeSocketOnGC to set.private void setConnectionParametersOnRequest(AbstractRequest request)
request - The request to set
private DriverResultSet receiveResultSet(java.lang.String callerName)
throws java.io.IOException,
ProtocolException,
SerializableException
callerName - used for error messages. Is this really useful?
java.io.IOException - stream or protocol error
SerializableException - received from the controller
ProtocolException
private void procedureOnStream(StoredProcedure proc,
boolean isRead)
throws java.io.IOException
proc - the procedure to sendisRead - true if this is a read stored procedure
java.io.IOException - if fails
private void writeRequestOnStream(AbstractWriteRequest request)
throws java.io.IOException
request - the write request to send
java.io.IOException - if fails
private SerializableException receiveException()
throws java.io.IOException
java.io.IOException - stream error
private java.lang.String receiveString()
throws java.io.IOException,
SerializableException
java.io.IOException - stream or protocol error
SerializableException - coming from the controller
private boolean receiveBoolean()
throws java.io.IOException,
SerializableException
java.io.IOException - stream or protocol error
SerializableException - coming from the controller
private int receiveInt()
throws java.io.IOException,
SerializableException
java.io.IOException - stream or protocol error
SerializableException - coming from the controller
private long receiveLong()
throws java.io.IOException,
SerializableException
java.io.IOException - stream or protocol error
SerializableException - coming from the controller
private void savepointOnStream(java.sql.Savepoint savepoint)
throws java.io.IOException
savepoint - the savepoint to send
java.io.IOException - if fails
private void reconnect()
throws DriverSQLException
DriverSQLException - if an error occured during reconnect
protected java.sql.ResultSet execReadRequest(SelectRequest request)
throws DriverSQLException
request - the read request to execute
java.sql.ResultSet value
DriverSQLException - if an error occurs
protected int execWriteRequest(AbstractWriteRequest request)
throws DriverSQLException
request - the write request to execute
DriverSQLException - if an error occurs
protected java.sql.ResultSet execWriteRequestWithKeys(AbstractWriteRequest request)
throws DriverSQLException
request - the write request to execute
DriverSQLException - if an error occurs
public java.sql.ResultSet execReadStoredProcedure(StoredProcedure proc)
throws DriverSQLException
proc - the stored procedure call
java.sql.ResultSet value
DriverSQLException - if an error occurs
protected int execWriteStoredProcedure(StoredProcedure proc)
throws DriverSQLException
proc - the stored procedure call
DriverSQLException - if an error occursAbstractBlobFilter getBlobFilter()
getBlobFilter()
protected java.sql.ResultSet getAttributes(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String typeNamePattern,
java.lang.String attributeNamePattern)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getAttributes(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
protected java.sql.ResultSet getBestRowIdentifier(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
int scope,
boolean nullable)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getBestRowIdentifier(java.lang.String,
java.lang.String, java.lang.String, int, boolean)
protected java.sql.ResultSet getColumnPrivileges(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableName,
java.lang.String columnNamePattern)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getColumnPrivileges(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
protected java.sql.ResultSet getColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String columnNamePattern)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getColumns(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
protected java.sql.ResultSet getCrossReference(java.lang.String primaryCatalog,
java.lang.String primarySchema,
java.lang.String primaryTable,
java.lang.String foreignCatalog,
java.lang.String foreignSchema,
java.lang.String foreignTable)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getCrossReference(java.lang.String,
java.lang.String, java.lang.String, java.lang.String,
java.lang.String, java.lang.String)
public java.sql.ResultSet getExportedKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getExportedKeys(java.lang.String,
java.lang.String, java.lang.String)
protected java.sql.ResultSet getImportedKeys(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getImportedKeys(java.lang.String,
java.lang.String, java.lang.String)
protected java.sql.ResultSet getIndexInfo(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
boolean unique,
boolean approximate)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getIndexInfo(java.lang.String,
java.lang.String, java.lang.String, boolean, boolean)
protected java.sql.ResultSet getPrimaryKeys(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getPrimaryKeys(java.lang.String,
java.lang.String, java.lang.String)
protected java.sql.ResultSet getSuperTables(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getSuperTables(java.lang.String,
java.lang.String, java.lang.String)
protected java.sql.ResultSet getSuperTypes(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String typeNamePattern)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getSuperTypes(java.lang.String,
java.lang.String, java.lang.String)
protected java.sql.ResultSet getTables(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String[] types)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getTables(String, String,
String, String[])
protected java.sql.ResultSet getTypeInfo()
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getTypeInfo()
protected java.sql.ResultSet getUDTs(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String typeNamePattern,
int[] types)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getUDTs(java.lang.String, java.lang.String,
java.lang.String, int[])
public java.sql.ResultSet getVersionColumns(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getVersionColumns(java.lang.String,
java.lang.String, java.lang.String)
java.lang.Object getStaticMetadata(java.lang.String key)
throws DriverSQLException
key - the "getXXX(Y,Z,...)" hash key of the metadata query
DriverSQLException - if failsVirtualDatabaseWorkerThread.databaseStaticMetadata(),
DatabaseBackendMetaData.retrieveDatabaseMetadata()
private DriverSQLException wrapIOExceptionInDriverSQLException(java.lang.String callerName,
java.io.IOException ioe)
public java.lang.String getControllerVersionNumber()
throws DriverSQLException
DriverSQLException - if an error occurs
public void setHoldability(int holdability)
throws java.sql.SQLException
ResultSet objects created using
this Connection object to the given holdability.
setHoldability in interface java.sql.Connectionholdability - a ResultSet holdability constant; one of
ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
java.sql.SQLException - if a database access occurs, the given parameter is
not a ResultSet constant indicating holdability,
or the given holdability is not supportedgetHoldability(),
ResultSet
public int getHoldability()
throws java.sql.SQLException
ResultSet objects
created using this Connection object.
getHoldability in interface java.sql.ConnectionResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
java.sql.SQLException - if a database access occurssetHoldability(int),
ResultSet
public java.sql.Savepoint setSavepoint()
throws DriverSQLException
Savepoint object that represents it.
setSavepoint in interface java.sql.ConnectionSavepoint object
DriverSQLException - if a database access error occurs or this
Connection object is currently in auto-commit
modeSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name)
throws DriverSQLException
Savepoint object that represents it.
setSavepoint in interface java.sql.Connectionname - a String containing the name of the savepoint
Savepoint object
DriverSQLException - if a database access error occurs or this
Connection object is currently in auto-commit
modeSavepoint
public void rollback(java.sql.Savepoint savepoint)
throws DriverSQLException
Savepoint object was
set.
This method should be used only when auto-commit has been disabled.
rollback in interface java.sql.Connectionsavepoint - the Savepoint object to roll back to
DriverSQLException - if a database access error occurs, the
Savepoint object is no longer valid, or this
Connection object is currently in auto-commit
modeSavepoint,
rollback()
public void releaseSavepoint(java.sql.Savepoint savepoint)
throws DriverSQLException
Savepoint object from the current
transaction. Any reference to the savepoint after it have been removed will
cause an SQLException to be thrown.
releaseSavepoint in interface java.sql.Connectionsavepoint - the Savepoint object to be removed
DriverSQLException - if a database access error occurs or the
given Savepoint object is not a valid savepoint
in the current transaction
public java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
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.
createStatement in interface java.sql.ConnectionresultSetType - one of the following ResultSet
constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - one of the following ResultSet
constants: ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLEresultSetHoldability - one of the following ResultSet
constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
Statement object that will generate
ResultSet objects with the given type, concurrency,
and holdability
java.sql.SQLException - if a database access error occurs or the given
parameters are not ResultSet constants
indicating type, concurrency, and holdabilityResultSet
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
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.
prepareStatement in interface java.sql.Connectionsql - a String object that is the SQL statement to be
sent to the database; may contain one or more ? IN parametersresultSetType - one of the following ResultSet
constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - one of the following ResultSet
constants: ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLEresultSetHoldability - one of the following ResultSet
constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
PreparedStatement object, containing the
pre-compiled SQL statement, that will generate
ResultSet objects with the given type, concurrency,
and holdability
java.sql.SQLException - if a database access error occurs or the given
parameters are not ResultSet constants
indicating type, concurrency, and holdabilityResultSet
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
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.
prepareCall in interface java.sql.Connectionsql - a String object that is the SQL statement to be
sent to the database; may contain on or more ? parametersresultSetType - one of the following ResultSet
constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - one of the following ResultSet
constants: ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLEresultSetHoldability - one of the following ResultSet
constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT
CallableStatement object, containing the
pre-compiled SQL statement, that will generate
ResultSet objects with the given type, concurrency,
and holdability
java.sql.SQLException - if a database access error occurs or the given
parameters are not ResultSet constants
indicating type, concurrency, and holdabilityResultSet
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
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.
prepareStatement in interface java.sql.Connectionsql - an SQL statement that may contain one or more '?' IN parameter
placeholdersautoGeneratedKeys - a flag indicating whether auto-generated keys
should be returned; one of
Statement.RETURN_GENERATED_KEYS or
Statement.NO_GENERATED_KEYS
PreparedStatement object, containing the
pre-compiled SQL statement, that will have the capability of
returning auto-generated keys
java.sql.SQLException - if a database access error occurs or the given
parameter is not a Statement constant
indicating whether auto-generated keys should be returned
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
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.
prepareStatement in interface java.sql.Connectionsql - an SQL statement that may contain one or more '?' IN parameter
placeholderscolumnIndexes - an array of column indexes indicating the columns that
should be returned from the inserted row or rows
PreparedStatement object, containing the
pre-compiled statement, that is capable of returning the
auto-generated keys designated by the given array of column indexes
java.sql.SQLException - if a database access error occurs
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
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.
prepareStatement in interface java.sql.Connectionsql - an SQL statement that may contain one or more '?' IN parameter
placeholderscolumnNames - an array of column names indicating the columns that
should be returned from the inserted row or rows
PreparedStatement object, containing the
pre-compiled statement, that is capable of returning the
auto-generated keys designated by the given array of column names
java.sql.SQLException - if a database access error occurs
public java.sql.ResultSet getTableTypes()
throws java.sql.SQLException
ResultSet each row has a single String column that
is a catalog name
java.sql.SQLException - if a database error occurs
public java.sql.ResultSet getTablePrivileges(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern)
throws DriverSQLException
catalog - a catalog name; "" retrieves those without a catalog; null
means drop catalog name from the selection criteriaschemaPattern - a schema name pattern; "" retrieves those without a
schematableNamePattern - a table name pattern
ResultSet each row is a table privilege description
DriverSQLException - if a database access error occurs
public java.sql.ResultSet getSchemas()
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getSchemas()
public java.lang.String getDatabaseProductName()
throws DriverSQLException
DriverSQLExceptionDatabaseMetaData.getDatabaseProductName()
public void fetchNextData(java.lang.String cursorName,
int fetchSize,
DriverResultSet drsToUpdate)
throws DriverSQLException
cursorName - name of the ResultSet cursorfetchSize - number of rows to fetchdrsToUpdate - DriverResultSet to update
DriverSQLException - if an error occursVirtualDatabaseWorkerThread.fetchNextResultSetRows()
public void closeRemoteResultSet(java.lang.String cursorName)
throws java.sql.SQLException
cursorName - cursor name of the ResultSet to close.
java.sql.SQLException - if an error occurspublic java.lang.String getPreparedStatementBooleanFalse()
public void setPreparedStatementBooleanFalse(java.lang.String booleanFalse)
booleanFalse - The booleanFalse to set.public java.lang.String getPreparedStatementBooleanTrue()
public void setPreparedStatementBooleanTrue(java.lang.String booleanTrue)
booleanTrue - The booleanTrue to set.public boolean isEscapeBackslash()
public void setEscapeBackslash(boolean escapeBackslash)
escapeBackslash - The escapeBackslash to set.public boolean isEscapeSingleQuote()
public void setEscapeSingleQuote(boolean escapeSingleQuote)
escapeSingleQuote - The escapeSingleQuote to set.void setDriverProcessed(boolean processedByDriver)
processedByDriver - true if the PreparedStatement are processed by the
C-JDBC driver.boolean isDriverProcessed()
isDriverProcessed()public void setEscapeChar(java.lang.String escapeChar)
escapeChar - the escapeChar value to setpublic java.lang.String getEscapeChar()
public boolean isConnectionPooling()
public void setConnectionPooling(boolean connectionPooling)
connectionPooling - The connectionPooling to set.public java.lang.String toString()
Object.toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||