|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.driver.Connection
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.
Field Summary | |
protected boolean |
autoCommit
Commit mode of the connection ( true = automatic). |
private AbstractBlobFilter |
blobFilter
|
private boolean |
closeSocketOnGC
|
protected Driver |
driver
Driver that created us. |
protected boolean |
driverProcessed
|
static java.lang.String |
END_PARAM_TAG
Tag for PreparedStatement parameters end delimiter |
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
Isolation level. |
protected static java.lang.String |
LINE_SEPARATOR
|
private static int |
MAX_RECONNECT_ATTEMPTS
|
protected DatabaseMetaData |
metaData
Meta-data of C-JDBC connections. |
protected boolean |
needSqlSkeleton
Does the controller require the SQL skeleton? |
protected java.lang.String |
preparedStatementBooleanFalse
|
protected java.lang.String |
preparedStatementBooleanTrue
|
protected boolean |
readOnly
Is the connection in read-only mode ? |
private int |
reconnectRetries
|
protected java.net.Socket |
socket
Connection with the controller. |
protected CJDBCInputStream |
socketInput
Socket input stream. |
protected CJDBCOutputStream |
socketOutput
Socket output stream. |
static java.lang.String |
START_PARAM_TAG
Tag for PreparedStatement parameters start delimiter |
static java.lang.String |
TAG_MARKER
Tag maker for PreparedStatement parameters |
static java.lang.String |
TAG_MARKER_ESCAPE
Escape for tag maker |
protected long |
transactionId
transaction identifier. |
protected java.lang.String |
url
C-JDBC URL of the database. |
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()
Creates a new Connection instance. |
|
Connection(Driver driver,
java.net.Socket socket,
CJDBCInputStream in,
CJDBCOutputStream out,
java.lang.String url,
java.lang.String userName,
java.lang.String password,
boolean sqlSkeletonNeeded,
AbstractBlobFilter filter)
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 return the number of rows affected. |
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()
|
boolean |
getAutoCommit()
Gets the current auto-commit state. |
AbstractBlobFilter |
getBlobFilter()
Returns the blobFilter value. |
java.lang.String |
getCatalog()
Return current catalog name. |
java.sql.ResultSet |
getCatalogs()
getCatalogs definition. |
protected java.sql.ResultSet |
getColumns(java.lang.String catalog,
java.lang.String schemaPattern,
java.lang.String tableNamePattern,
java.lang.String columnNamePattern)
|
java.lang.String |
getConnectedController()
Get the controller description to which this connection is connected to |
java.lang.String |
getControllerVersionNumber()
Get the C-JDBC controller version number. |
java.lang.String |
getDatabaseProductName()
|
java.lang.String |
getEscapeChar()
|
int |
getHoldability()
Retrieves the current holdability of ResultSet objects
created using this Connection object. |
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()
|
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. |
java.util.Map |
getTypeMap()
C-JDBC does NOT support type map. |
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.SQLWarning |
getWarnings()
The first warning reported by calls on this connection is returned. |
boolean |
isClosed()
Returns true if the connection is closed (no real meaning
from C-JDBC point of view) |
boolean |
isDriverProcessed()
Returns the driverProcessed value. |
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 void |
readRequestOnStream(SelectRequest request)
Serialize a read request on the output stream by sending only the needed parameters to reconstruct it on the controller |
private void |
reconnect()
|
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.
|
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 |
protected void |
setCloseSocketOnGC(boolean closeSocketOnGC)
Sets the closeSocketOnGC value. |
protected void |
setConnectionParametersOnRequest(AbstractRequest request)
Set the autocommit mode and read-only status on this request. |
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 |
writeRequestOnStream(AbstractWriteRequest request,
boolean withKeys)
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, toString, wait, wait, wait |
Field Detail |
protected boolean autoCommit
true
= automatic).
protected boolean isClosed
protected boolean readOnly
boolean writeExecutedInTransaction
protected int isolationLevel
protected long transactionId
protected boolean needSqlSkeleton
protected java.sql.SQLWarning firstWarning
Warnings
for this connection.
protected DatabaseMetaData metaData
protected Driver driver
protected java.lang.String url
protected java.lang.String vdbUser
protected java.lang.String vdbPassword
protected java.net.Socket socket
protected CJDBCInputStream socketInput
protected CJDBCOutputStream socketOutput
private int reconnectRetries
private static final int MAX_RECONNECT_ATTEMPTS
private AbstractBlobFilter blobFilter
protected boolean escapeBackslash
protected boolean escapeSingleQuote
protected boolean driverProcessed
public static final java.lang.String TAG_MARKER
public static final java.lang.String TAG_MARKER_ESCAPE
public static final java.lang.String START_PARAM_TAG
public static final java.lang.String END_PARAM_TAG
protected java.lang.String preparedStatementBooleanTrue
protected java.lang.String preparedStatementBooleanFalse
protected java.lang.String escapeChar
protected static final java.lang.String LINE_SEPARATOR
private boolean closeSocketOnGC
Constructor Detail |
public Connection()
Connection
instance.
public Connection(Driver driver, java.net.Socket socket, CJDBCInputStream in, CJDBCOutputStream out, java.lang.String url, java.lang.String userName, java.lang.String password, boolean sqlSkeletonNeeded, AbstractBlobFilter filter)
Connection
instance.
driver
- calling driversocket
- connection with the controllerin
- socket input streamout
- socket output streamurl
- C-JDBC URL of the databaseuserName
- user loginpassword
- user passwordsqlSkeletonNeeded
- true if SQL skeletons must be sent to the
controllerfilter
- to use to encode and decode blobsMethod Detail |
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
Object.finalize()
public java.lang.String getURL()
public java.lang.String getUserName()
public java.lang.String getPassword()
public java.lang.String getConnectedController()
String
like localhost:25322
or null
if not connectedpublic void clearWarnings() throws java.sql.SQLException
getWarnings()
returns null
until a new warning is reported for this connection.
clearWarnings
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic void close() throws java.sql.SQLException
ConnectionClosingThread
if the connection has not been reused before.
close
in interface java.sql.Connection
java.sql.SQLException
- if an error occurspublic void commit() throws java.sql.SQLException
Connection
.
This method should only be used when auto-commit has been disabled. (If
autoCommit
==true
, then we throw an
SQLException).
commit
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurs or the connection
is in autocommit modesetAutoCommit(boolean)
public java.sql.Statement createStatement() throws java.sql.SQLException
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:
java.sql.SQLException
- 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.Connection
resultSetType
- resultSetType to useresultSetConcurrency
- resultSetConcurrency to use
Statement
object
java.sql.SQLException
- passed through from the constructorpublic boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
- (why?)setAutoCommit(boolean)
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
DatabaseMetaData
object for this connection
java.sql.SQLException
- if a database access error occurspublic java.lang.String getCatalog() throws java.sql.SQLException
getCatalog
in interface java.sql.Connection
VirtualDatabase
java.sql.SQLException
- if any error occursConnection.getCatalog()
public java.sql.ResultSet getCatalogs() throws java.sql.SQLException
ResultSet
- Throws:
java.sql.SQLException
- 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 java.sql.SQLException
java.sql.SQLException
protected java.sql.ResultSet getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLException
java.sql.SQLException
public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
TRANSACTION_*
mode value
java.sql.SQLException
- if a database access error occurspublic java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
java.sql.SQLException
- not supportedpublic java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic boolean isClosed() throws java.sql.SQLException
true
if the connection is closed (no real meaning
from C-JDBC point of view)
isClosed
in interface java.sql.Connection
true
if connection has never been opened or
close()
has been called
java.sql.SQLException
- if an error occurspublic boolean isReadOnly() throws java.sql.SQLException
readOnly
flag.
isReadOnly
in interface java.sql.Connection
true
if the connection is read only
java.sql.SQLException
- if a database access error occurspublic java.lang.String nativeSQL(java.lang.String query) throws java.sql.SQLException
nativeSQL
in interface java.sql.Connection
query
- the query to change
java.sql.SQLException
- neverpublic java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
sql
- SQL request
java.sql.SQLException
- not supportedpublic java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
sql
- a String
valueresultSetType
- an int
valueresultSetConcurrency
- an int
value
java.sql.SQLException
- not supportedpublic 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.Connection
sql
- 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.Connection
sql
- 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 constructorpublic void rollback() throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurs or the connection
is in autocommit modecommit()
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
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.Connection
autoCommit
- true
enables auto-commit;
false
disables it
java.sql.SQLException
- if a database access error occurspublic void setCatalog(java.lang.String catalog) throws java.sql.SQLException
setCatalog
in interface java.sql.Connection
catalog
- a String
value
java.sql.SQLException
- if fails or if catalog name is invalidpublic void setReadOnly(boolean readOnly) throws java.sql.SQLException
Note: setReadOnly cannot be called while in the middle of a transaction with write requests.
setReadOnly
in interface java.sql.Connection
readOnly
- true
enables read-only mode;
false
disables it
java.sql.SQLException
- if a database access error occurspublic void setTransactionIsolation(int level) throws java.sql.SQLException
Note: this method cannot be called while in the middle of a transaction.
setTransactionIsolation
in interface java.sql.Connection
level
- one of the TRANSACTION_* isolation values with * the exception
of TRANSACTION_NONE; some databases may * not support other values
java.sql.SQLException
- if a database access error occursDatabaseMetaData.supportsTransactionIsolationLevel(int)
public void setTypeMap(java.util.Map map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
map
- ignored
java.sql.SQLException
- not supportedprotected void setConnectionParametersOnRequest(AbstractRequest request)
request
- The request to setprotected java.sql.ResultSet execReadRequest(SelectRequest request) throws java.sql.SQLException
request
- the read request to execute
java.sql.ResultSet
value
java.sql.SQLException
- if an error occursprivate void reconnect() throws java.sql.SQLException
java.sql.SQLException
protected void setCloseSocketOnGC(boolean closeSocketOnGC)
closeSocketOnGC
- The closeSocketOnGC to set.protected int execWriteRequest(AbstractWriteRequest request) throws java.sql.SQLException
request
- the write request to execute
java.sql.SQLException
- if an error occursprivate void readRequestOnStream(SelectRequest request) throws java.io.IOException
request
- the read request to send
java.io.IOException
- if failsprivate 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 failsprivate void writeRequestOnStream(AbstractWriteRequest request, boolean withKeys) throws java.io.IOException
request
- the write request to sendwithKeys
- true if this request expect keys to be returned (as a
ResultSet)
java.io.IOException
- if failsprotected java.sql.ResultSet execWriteRequestWithKeys(AbstractWriteRequest request) throws java.sql.SQLException
request
- the write request to execute
java.sql.SQLException
- if an error occurspublic java.sql.ResultSet execReadStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
proc
- the stored procedure call
java.sql.ResultSet
value
java.sql.SQLException
- if an error occursprotected int execWriteStoredProcedure(StoredProcedure proc) throws java.sql.SQLException
proc
- the stored procedure call
java.sql.SQLException
- if an error occursprotected java.sql.ResultSet getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.ResultSet getPrimaryKeys(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern) throws java.sql.SQLException
java.sql.SQLException
DatabaseMetaData.getPrimaryKeys(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 java.sql.SQLException
java.sql.SQLException
DatabaseMetaData.getTables(String, String,
String, String[])
public java.lang.String getControllerVersionNumber() throws java.sql.SQLException
java.sql.SQLException
- if an error occurspublic void setHoldability(int holdability) throws java.sql.SQLException
ResultSet
objects created using
this Connection
object to the given holdability.
setHoldability
in interface java.sql.Connection
holdability
- 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.Connection
ResultSet.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 java.sql.SQLException
Savepoint
object that represents it.
setSavepoint
in interface java.sql.Connection
Savepoint
object
java.sql.SQLException
- 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 java.sql.SQLException
Savepoint
object that represents it.
setSavepoint
in interface java.sql.Connection
name
- a String
containing the name of the savepoint
Savepoint
object
java.sql.SQLException
- if a database access error occurs or this
Connection
object is currently in auto-commit
modeSavepoint
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
Savepoint
object was
set.
This method should be used only when auto-commit has been disabled.
rollback
in interface java.sql.Connection
savepoint
- the Savepoint
object to roll back to
java.sql.SQLException
- 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 java.sql.SQLException
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.Connection
savepoint
- the Savepoint
object to be removed
java.sql.SQLException
- if a database access error occurs or the given
Savepoint
object is not a valid savepoint in
the current transactionpublic 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.Connection
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
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.Connection
sql
- 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_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
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.Connection
sql
- 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_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
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.Connection
sql
- 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 returnedpublic 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.Connection
sql
- 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 occurspublic 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.Connection
sql
- 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 occurspublic AbstractBlobFilter getBlobFilter()
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 occurspublic java.sql.ResultSet getTablePrivileges(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern) throws java.sql.SQLException
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
java.sql.SQLException
- if a database access error occurspublic java.sql.ResultSet getSchemas() throws java.sql.SQLException
java.sql.SQLException
DatabaseMetaData.getSchemas()
public java.lang.String getDatabaseProductName() throws java.sql.SQLException
java.sql.SQLException
DatabaseMetaData.getDatabaseProductName()
public void fetchNextData(java.lang.String cursorName, int fetchSize, DriverResultSet drsToUpdate) throws java.sql.SQLException
cursorName
- name of the ResultSet cursorfetchSize
- number of rows to fetchdrsToUpdate
- DriverResultSet to update
java.sql.SQLException
- if an error occurspublic 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.public void setDriverProcessed(boolean processedByDriver)
processedByDriver
- true if the PreparedStatement are processed by the
C-JDBC driver.public boolean isDriverProcessed()
public void setEscapeChar(java.lang.String escapeChar)
escapeChar
- the escapeChar value to setpublic java.lang.String getEscapeChar()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |