Class AceQLConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Cloneable,Connection,Wrapper
public class AceQLConnection extends com.aceql.jdbc.commons.main.abstracts.AbstractConnection implements Connection, Cloneable, Closeable
Connection implementation that enable to use a
virtual JDBC Connection that is mapped to a Server JDBC
Connection in order to access a remote SQL database through
HTTP. This class acts as a wrapper of AceQL HTTP APIs.
This Connection implementation supports:
- Main JDBC data formats.
Blobupdates.Blobreads.- Transaction through
commitandrollbackorders.
Supplementary specific methods that are not of instance of
java.sql.Connection interface are also added.
After getting the AceQLConnection with
DriverManager.getConnection(String, Properties) just use it like a
regular Connection to execute your
PreparedStatement and Statement, and to navigate
through your ResultSet.
Check the user documentation or the Javadoc of your AceQL JDBC Driver Edition for more info:
AceQLDriverfor the Community Edition.AceQLDriverProfor the Professional Edition.
All thrown exceptions are of type AceQLException. Use
Throwable.getCause() to get the original wrapped Exception.
The AceQL error_type value is available via the
AceQLException#getErrorCode() and the remote_stack value as a string
is available with AceQLException.getRemoteStackTrace().
The following dedicated AceQLConnection methods are specific to
the software and may be accessed with a cast:
getClientVersion(): Gets the AceQL JDBC version info.getServerVersion(): Gets the AceQL HTTP Server version info.getConnectionInfo(): Gets major options/Properties passed when callingDriverManager.getConnection(String, Properties).setProgress(AtomicInteger): Allows to pass a sharable progress value. See below.-
setCancelled(AtomicBoolean): Allows to pass a sharable canceled variable that will be used by the progress indicator to notify this instance that the end user has cancelled the current Blob/Clob upload or download
More info about the current AceQLConnection are accessible through the
ConnectionInfo:
// Casts the current Connection to get an AceQLConnection object
AceQLConnection aceqlConnection = (AceQLConnection) connection;
ConnectionInfo connectionInfo = aceqlConnection.getConnectionInfo();
All long Blobs update/reading that need to be run on a separated thread may be followed in Swing using a
JProgressBar,
ProgressMonitor or Android using a ProgressDialog
This is done by sharing two atomic variables that will be declared as fields:
- An
AtomicIntegerthat represents the Blob/Clob transfer progress between 0 and 100. - An
AtomicBooleanthat says if the end user has cancelled the Blob/Clob transfer.
The atomic variables values will be shared by AceQL download/upload processes
and by the Progress Monitor used for the Progress Bar. The values are to be
initialized and passed to AceQLConnection before the JDBC actions
with the setters:
Example:
See the source code of SqlProgressMonitorDemo.java that demonstrates the use of atomic variables when inserting a Blob.// Attempts to establish a connection to the remote database: Connection connection = DriverManager.getConnection(url, info); // Pass the mutable & sharable progress and canceled to the // underlying AceQLConnection. // - progress value will be updated by the AceQLConnection and // retrieved by progress monitors to increment the progress. // - cancelled value will be updated to true if user cancels the // task and AceQLConnection will interrupt the Blob(s) transfer. ((AceQLConnection) connection).setProgress(progress); ((AceQLConnection) connection).setCancelled(cancelled); // Execute JDBC statement
See also
AceQLBlob that describes how to use Blobs.- Author:
- Nicolas de Pomereu
-
Field Summary
Fields inherited from class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
FEATURE_NOT_SUPPORTED_IN_THIS_VERSIONFields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Method Summary
Modifier and Type Method Description voidclearWarnings()Clears all warnings reported for thisConnectionobject.Connectionclone()voidclose()Releases thisConnectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.voidcommit()Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by thisConnectionobject.BlobcreateBlob()Constructs an object that implements theBlobinterface.StatementcreateStatement()Creates aStatementobject for sending SQL statements to the database.StatementcreateStatement(int resultSetType, int resultSetConcurrency)Creates aStatementobject that will generateResultSetobjects with the given type and concurrency.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Creates aStatementobject that will generateResultSetobjects with the given type, concurrency, and holdability.booleangetAutoCommit()Retrieves the current auto-commit mode for thisConnectionobject.AtomicBooleangetCancelled()Returns the cancelled value set by the progress indicatorStringgetCatalog()Retrieves thisConnectionobject's current catalog name.PropertiesgetClientInfo()Returns a list containing the name and current value of each client info property supported by the driver.StringgetClientInfo(String name)Returns the value of the client info property specified by name.StringgetClientVersion()Returns the SDK current Version.ConnectionInfogetConnectionInfo()Gets all info of thisAceQLConnectioninstanceintgetHoldability()Retrieves the current holdability ofResultSetobjects created using thisConnectionobject.DatabaseMetaDatagetMetaData()Retrieves aDatabaseMetaDataobject that contains metadata about the database to which thisConnectionobject represents a connection.AtomicIntegergetProgress()Returns the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100RemoteDatabaseMetaDatagetRemoteDatabaseMetaData()Returns a RemoteDatabaseMetaData instance in order to retrieve metadata info for all client SDKs.StringgetSchema()StringgetServerVersion()Returns the server product versionintgetTransactionIsolation()Retrieves thisConnectionobject's current transaction isolation level.SQLWarninggetWarnings()Retrieves the first warning reported by calls on thisConnectionobject.booleanisClosed()Retrieves whether thisConnectionobject has been closed.booleanisReadOnly()Retrieves whether thisConnectionobject is in read-only mode.booleanisValid(int timeout)Returns true if the connection has not been closed and is still valid.voidlogout()Calls /logout AceQL HTTP API on server side.CallableStatementprepareCall(String sql)Creates aCallableStatementobject for calling database stored procedures.PreparedStatementprepareStatement(String sql)Creates aPreparedStatementobject for sending parameterized SQL statements to the database.PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)Creates a defaultPreparedStatementobject that has the capability to retrieve auto-generated keys.PreparedStatementprepareStatement(String sql, int[] columnIndexes)Creates a defaultPreparedStatementobject capable of returning the auto-generated keys designated by the given array.PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)Creates aPreparedStatementobject that will generateResultSetobjects with the given type and concurrency.PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Creates aPreparedStatementobject that will generateResultSetobjects with the given type, concurrency, and holdability.PreparedStatementprepareStatement(String sql, String[] columnNames)Creates a defaultPreparedStatementobject capable of returning the auto-generated keys designated by the given array.voidreleaseSavepoint(Savepoint savepoint)Removes the givenSavepointobject from the current transaction.voidrollback()Undoes all changes made in the current transaction and releases any database locks currently held by thisConnectionobject.voidrollback(Savepoint savepoint)Undoes all changes made after the givenSavepointobject was set.voidsetAutoCommit(boolean autoCommit)Sets this connection's auto-commit mode to the given state.voidsetCancelled(AtomicBoolean cancelled)Sets the sharable canceled variable that will be used by the progress indicator to notify this instance that the user has cancelled the current Blob/Clob upload or download.voidsetCatalog(String catalog)Sets the given catalog name in order to select a subspace of thisConnectionobject's database in which to work.voidsetClientInfo(String name, String value)Sets the value of the client info property specified by name to the value specified by value.voidsetClientInfo(Properties properties)Sets the value of the connection's client info properties.voidsetHoldability(int holdability)Changes the holdability ofResultSetobjects created using thisConnectionobject to the given holdability.voidsetNetworkTimeout(Executor arg0, int arg1)voidsetProgress(AtomicInteger progress)Sets the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100.voidsetReadOnly(boolean readOnly)Puts this connection in read-only mode as a hint to the driver to enable database optimizations.SavepointsetSavepoint()Creates an unnamed savepoint in the current transaction and returns the newSavepointobject that represents it.SavepointsetSavepoint(String name)Creates a savepoint with the given name in the current transaction and returns the newSavepointobject that represents it.voidsetSchema(String arg0)voidsetTransactionIsolation(int level)Attempts to change the transaction isolation level for thisConnectionobject to the one given.StringtoString()Methods inherited from class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
abort, createArrayOf, createClob, createNClob, createSQLXML, createStruct, getNetworkTimeout, getTypeMap, isWrapperFor, nativeSQL, prepareCall, prepareCall, setTypeMap, unwrapMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.sql.Connection
abort, beginRequest, createArrayOf, createClob, createNClob, createSQLXML, createStruct, endRequest, getNetworkTimeout, getTypeMap, nativeSQL, prepareCall, prepareCall, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTypeMapMethods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Method Details
-
createBlob
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionConstructs an object that implements theBlobinterface. The object returned initially contains no data. ThesetBinaryStreamandsetBytesmethods of theBlobinterface may be used to add data to theBlob.- Specified by:
createBlobin interfaceConnection- Overrides:
createBlobin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- An object that implements the
Blobinterface - Throws:
SQLException- if an object that implements theBlobinterface can not be constructed, this method is called on a closed connection or a database access error occurs.SQLFeatureNotSupportedException- if the JDBC driver does not support this data type
-
getMetaData
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves aDatabaseMetaDataobject that contains metadata about the database to which thisConnectionobject represents a connection. The metadata includes information about the database's tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on.- Specified by:
getMetaDatain interfaceConnection- Overrides:
getMetaDatain classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- a
DatabaseMetaDataobject for thisConnectionobject - Throws:
SQLException- if a database access error occurs
-
getRemoteDatabaseMetaData
Returns a RemoteDatabaseMetaData instance in order to retrieve metadata info for all client SDKs.- Returns:
- a RemoteDatabaseMetaData instance in order to retrieve metadata info.
-
close
public void close()Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionReleases thisConnectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.Calling the method
closeon aConnectionobject that is already closed is a no-op.Note: A
Connectionobject is automatically closed when it is garbage collected. Certain fatal errors also close aConnectionobject.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnection- Overrides:
closein classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
-
logout
public void logout()Calls /logout AceQL HTTP API on server side. Will close all the opened JDBC Connections on server side for the database in use. -
commit
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionMakes all changes made since the previous commit/rollback permanent and releases any database locks currently held by thisConnectionobject. This method should be used only when auto-commit mode has been disabled.- Specified by:
commitin interfaceConnection- Overrides:
commitin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Throws:
SQLException- if a database access error occurs or thisConnectionobject is in auto-commit mode- See Also:
AbstractConnection.setAutoCommit(boolean)
-
rollback
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionUndoes all changes made in the current transaction and releases any database locks currently held by thisConnectionobject. This method should be used only when auto-commit mode has been disabled.- Specified by:
rollbackin interfaceConnection- Overrides:
rollbackin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Throws:
SQLException- if a database access error occurs or thisConnectionobject is in auto-commit mode- See Also:
AbstractConnection.setAutoCommit(boolean)
-
setSavepoint
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates an unnamed savepoint in the current transaction and returns the newSavepointobject that represents it.- Specified by:
setSavepointin interfaceConnection- Overrides:
setSavepointin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- the new
Savepointobject - Throws:
SQLException- if a database access error occurs or thisConnectionobject is currently in auto-commit mode- See Also:
Savepoint
-
setSavepoint
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates a savepoint with the given name in the current transaction and returns the newSavepointobject that represents it.- Specified by:
setSavepointin interfaceConnection- Overrides:
setSavepointin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
name- aStringcontaining the name of the savepoint- Returns:
- the new
Savepointobject - Throws:
SQLException- if a database access error occurs or thisConnectionobject is currently in auto-commit mode- See Also:
Savepoint
-
rollback
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionUndoes all changes made after the givenSavepointobject was set.This method should be used only when auto-commit has been disabled.
- Specified by:
rollbackin interfaceConnection- Overrides:
rollbackin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
savepoint- theSavepointobject to roll back to- Throws:
SQLException- if a database access error occurs, theSavepointobject is no longer valid, or thisConnectionobject is currently in auto-commit mode- See Also:
Savepoint,AbstractConnection.rollback()
-
releaseSavepoint
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRemoves the givenSavepointobject from the current transaction. Any reference to the savepoint after it have been removed will cause anSQLExceptionto be thrown.- Specified by:
releaseSavepointin interfaceConnection- Overrides:
releaseSavepointin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
savepoint- theSavepointobject to be removed- Throws:
SQLException- if a database access error occurs or the givenSavepointobject is not a valid savepoint in the current transaction
-
setTransactionIsolation
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionAttempts to change the transaction isolation level for thisConnectionobject to the one given. The constants defined in the interfaceConnectionare the possible transaction isolation levels.Note: If this method is called during a transaction, the result is implementation-defined.
- Specified by:
setTransactionIsolationin interfaceConnection- Overrides:
setTransactionIsolationin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
level- one of the followingConnectionconstants:Connection.TRANSACTION_READ_UNCOMMITTED,Connection.TRANSACTION_READ_COMMITTED,Connection.TRANSACTION_REPEATABLE_READ, orConnection.TRANSACTION_SERIALIZABLE. (Note thatConnection.TRANSACTION_NONEcannot be used because it specifies that transactions are not supported.)- Throws:
SQLException- if a database access error occurs or the given parameter is not one of theConnectionconstants- See Also:
DatabaseMetaData.supportsTransactionIsolationLevel(int),AbstractConnection.getTransactionIsolation()
-
setHoldability
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionChanges the holdability ofResultSetobjects created using thisConnectionobject to the given holdability.- Specified by:
setHoldabilityin interfaceConnection- Overrides:
setHoldabilityin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
holdability- aResultSetholdability constant; one ofResultSet.HOLD_CURSORS_OVER_COMMITorResultSet.CLOSE_CURSORS_AT_COMMIT- Throws:
SQLException- if a database access occurs, the given parameter is not aResultSetconstant indicating holdability, or the given holdability is not supported- See Also:
AbstractConnection.getHoldability(),ResultSet
-
setAutoCommit
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionSets this connection's auto-commit mode to the given state. 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 a call to either the methodcommitor the methodrollback. 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
ResultSetobject, the statement completes when the last row of theResultSetobject has been retrieved or theResultSetobject has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. In these cases, the commit occurs when all results and output parameter values have been retrieved.NOTE: If this method is called during a transaction, the transaction is committed.
- Specified by:
setAutoCommitin interfaceConnection- Overrides:
setAutoCommitin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
autoCommit-trueto enable auto-commit mode;falseto disable it- Throws:
SQLException- if a database access error occurs- See Also:
AbstractConnection.getAutoCommit()
-
getAutoCommit
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves the current auto-commit mode for thisConnectionobject.- Specified by:
getAutoCommitin interfaceConnection- Overrides:
getAutoCommitin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- the current state of this
Connectionobject's auto-commit mode - Throws:
SQLException- if a database access error occurs- See Also:
AbstractConnection.setAutoCommit(boolean)
-
setReadOnly
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionPuts this connection in read-only mode as a hint to the driver to enable database optimizations.Note: This method cannot be called during a transaction.
- Specified by:
setReadOnlyin interfaceConnection- Overrides:
setReadOnlyin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
readOnly-trueenables read-only mode;falsedisables it- Throws:
SQLException- if a database access error occurs or this method is called during a transaction
-
isReadOnly
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves whether thisConnectionobject is in read-only mode.- Specified by:
isReadOnlyin interfaceConnection- Overrides:
isReadOnlyin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
trueif thisConnectionobject is read-only;falseotherwise- Throws:
SQLException- if a database access error occurs
-
getHoldability
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves the current holdability ofResultSetobjects created using thisConnectionobject.- Specified by:
getHoldabilityin interfaceConnection- Overrides:
getHoldabilityin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- the holdability, one of
ResultSet.HOLD_CURSORS_OVER_COMMITorResultSet.CLOSE_CURSORS_AT_COMMIT - Throws:
SQLException- if a database access occurs- See Also:
AbstractConnection.setHoldability(int),ResultSet
-
getTransactionIsolation
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves thisConnectionobject's current transaction isolation level.- Specified by:
getTransactionIsolationin interfaceConnection- Overrides:
getTransactionIsolationin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- the current transaction isolation level, which will be one of the
following constants:
Connection.TRANSACTION_READ_UNCOMMITTED,Connection.TRANSACTION_READ_COMMITTED,Connection.TRANSACTION_REPEATABLE_READ,Connection.TRANSACTION_SERIALIZABLE, orConnection.TRANSACTION_NONE. - Throws:
SQLException- if a database access error occurs- See Also:
AbstractConnection.setTransactionIsolation(int)
-
getCatalog
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves thisConnectionobject's current catalog name.- Specified by:
getCatalogin interfaceConnection- Overrides:
getCatalogin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- the current catalog name or
nullif there is none - Throws:
SQLException- if a database access error occurs- See Also:
AbstractConnection.setCatalog(java.lang.String)
-
getSchema
- Specified by:
getSchemain interfaceConnection- Overrides:
getSchemain classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Throws:
SQLException
-
createStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aStatementobject for sending SQL statements to the database. SQL statements without parameters are normally executed usingStatementobjects. If the same SQL statement is executed many times, it may be more efficient to use aPreparedStatementobject.Result sets created using the returned
Statementobject will by default be typeTYPE_FORWARD_ONLYand have a concurrency level ofCONCUR_READ_ONLY.- Specified by:
createStatementin interfaceConnection- Overrides:
createStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- a new default
Statementobject - Throws:
SQLException- if a database access error occurs
-
createStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aStatementobject that will generateResultSetobjects with the given type and concurrency. This method is the same as thecreateStatementmethod above, but it allows the default result set type and concurrency to be overridden.- Specified by:
createStatementin interfaceConnection- Overrides:
createStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
resultSetType- a result set type; one ofResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency- a concurrency type; one ofResultSet.CONCUR_READ_ONLYorResultSet.CONCUR_UPDATABLE- Returns:
- a new
Statementobject that will generateResultSetobjects with the given type and concurrency - Throws:
SQLException- if a database access error occurs or the given parameters are notResultSetconstants indicating type and concurrency
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aStatementobject that will generateResultSetobjects with the given type, concurrency, and holdability. This method is the same as thecreateStatementmethod above, but it allows the default result set type, concurrency, and holdability to be overridden.- Specified by:
createStatementin interfaceConnection- Overrides:
createStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
resultSetType- one of the followingResultSetconstants:ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency- one of the followingResultSetconstants:ResultSet.CONCUR_READ_ONLYorResultSet.CONCUR_UPDATABLEresultSetHoldability- one of the followingResultSetconstants:ResultSet.HOLD_CURSORS_OVER_COMMITorResultSet.CLOSE_CURSORS_AT_COMMIT- Returns:
- a new
Statementobject that will generateResultSetobjects with the given type, concurrency, and holdability - See Also:
ResultSet
-
prepareStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aPreparedStatementobject for sending parameterized SQL statements to the database.A SQL statement with or without IN parameters can be pre-compiled and stored in a
PreparedStatementobject. 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
prepareStatementwill 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 thePreparedStatementobject is executed. This has no direct effect on users; however, it does affect which methods throw certainSQLExceptionobjects.Result sets created using the returned
PreparedStatementobject will by default be typeTYPE_FORWARD_ONLYand have a concurrency level ofCONCUR_READ_ONLY.- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
sql- an SQL statement that may contain one or more '?' IN parameter placeholders- Returns:
- a new default
PreparedStatementobject containing the pre-compiled SQL statement - Throws:
SQLException- if a database access error occurs
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLExceptionDescription copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aPreparedStatementobject that will generateResultSetobjects with the given type and concurrency. This method is the same as theprepareStatementmethod above, but it allows the default result set type and concurrency to be overridden.- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
sql- aStringobject that is the SQL statement to be sent to the database; may contain one or more ? IN parametersresultSetType- a result set type; one ofResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency- a concurrency type; one ofResultSet.CONCUR_READ_ONLYorResultSet.CONCUR_UPDATABLE- Returns:
- a new PreparedStatement object containing the pre-compiled SQL
statement that will produce
ResultSetobjects with the given type and concurrency - Throws:
SQLException- if a database access error occurs or the given parameters are notResultSetconstants indicating type and concurrency
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLExceptionDescription copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aPreparedStatementobject that will generateResultSetobjects with the given type, concurrency, and holdability.This method is the same as the
prepareStatementmethod above, but it allows the default result set type, concurrency, and holdability to be overridden.- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
sql- aStringobject that is the SQL statement to be sent to the database; may contain one or more ? IN parametersresultSetType- one of the followingResultSetconstants:ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency- one of the followingResultSetconstants:ResultSet.CONCUR_READ_ONLYorResultSet.CONCUR_UPDATABLEresultSetHoldability- one of the followingResultSetconstants:ResultSet.HOLD_CURSORS_OVER_COMMITorResultSet.CLOSE_CURSORS_AT_COMMIT- Returns:
- a new
PreparedStatementobject, containing the pre-compiled SQL statement, that will generateResultSetobjects with the given type, concurrency, and holdability - Throws:
SQLException- if a database access error occurs or the given parameters are notResultSetconstants indicating type, concurrency, and holdability- See Also:
ResultSet
-
prepareStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates a defaultPreparedStatementobject 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 anINSERTstatement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific).Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method
prepareStatementwill 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 thePreparedStatementobject is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.Result sets created using the returned
PreparedStatementobject will by default be typeTYPE_FORWARD_ONLYand have a concurrency level ofCONCUR_READ_ONLY. The holdability of the created result sets can be determined by callingAbstractConnection.getHoldability().- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
sql- an SQL statement that may contain one or more '?' IN parameter placeholdersautoGeneratedKeys- a flag indicating whether auto-generated keys should be returned; one ofStatement.RETURN_GENERATED_KEYSorStatement.NO_GENERATED_KEYS- Returns:
- a new
PreparedStatementobject, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys - Throws:
SQLException- if a database access error occurs, this method is called on a closed connection or the given parameter is not aStatementconstant indicating whether auto-generated keys should be returnedSQLFeatureNotSupportedException- if the JDBC driver does not support this method with a constant of Statement.RETURN_GENERATED_KEYS
-
prepareStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates a defaultPreparedStatementobject 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 anINSERTstatement.An SQL statement with or without IN parameters can be pre-compiled and stored in a
PreparedStatementobject. 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
prepareStatementwill 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 thePreparedStatementobject is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.Result sets created using the returned
PreparedStatementobject will by default be typeTYPE_FORWARD_ONLYand have a concurrency level ofCONCUR_READ_ONLY.- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
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- Returns:
- a new
PreparedStatementobject, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes - Throws:
SQLException- if a database access error occurs
-
prepareStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates a defaultPreparedStatementobject 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 anINSERTstatement.An SQL statement with or without IN parameters can be pre-compiled and stored in a
PreparedStatementobject. 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
prepareStatementwill 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 thePreparedStatementobject is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.Result sets created using the returned
PreparedStatementobject will by default be typeTYPE_FORWARD_ONLYand have a concurrency level ofCONCUR_READ_ONLY.- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
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- Returns:
- a new
PreparedStatementobject, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names - Throws:
SQLException- if a database access error occurs
-
prepareCall
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionCreates aCallableStatementobject for calling database stored procedures. TheCallableStatementobject provides methods for setting up its IN and OUT parameters, and methods for executing the call to a stored procedure.Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the method
prepareCallis done; others may wait until theCallableStatementobject is executed. This has no direct effect on users; however, it does affect which method throws certain SQLExceptions.Result sets created using the returned
CallableStatementobject will by default be typeTYPE_FORWARD_ONLYand have a concurrency level ofCONCUR_READ_ONLY.- Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
sql- an SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is a JDBC function call escape string.- Returns:
- a new default
CallableStatementobject containing the pre-compiled SQL statement - Throws:
SQLException- if a database access error occurs
-
getWarnings
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves the first warning reported by calls on thisConnectionobject. If there is more than one warning, subsequent warnings will be chained to the first one and can be retrieved by calling the methodSQLWarning.getNextWarningon the warning that was retrieved previously.This method may not be called on a closed connection; doing so will cause an
SQLExceptionto be thrown.Note: Subsequent warnings will be chained to this SQLWarning.
- Specified by:
getWarningsin interfaceConnection- Overrides:
getWarningsin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- the first
SQLWarningobject ornullif there are none - Throws:
SQLException- if a database access error occurs or this method is called on a closed connection- See Also:
SQLWarning
-
clone
-
getClientVersion
Returns the SDK current Version.- Returns:
- the SDK current Version
-
getServerVersion
Returns the server product version- Returns:
- the server product version
- Throws:
AceQLException- if any Exception occurs
-
getCancelled
Returns the cancelled value set by the progress indicator- Returns:
- the cancelled value set by the progress indicator
-
getProgress
Returns the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100- Returns:
- the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100
-
setCancelled
Sets the sharable canceled variable that will be used by the progress indicator to notify this instance that the user has cancelled the current Blob/Clob upload or download.- Parameters:
cancelled- the sharable canceled variable that will be used by the progress indicator to notify this instance that the end user has cancelled the current Blob/Clob upload or download
-
setProgress
Sets the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100. Will be used by progress indicators to show the progress.- Parameters:
progress- the sharable progress variable
-
clearWarnings
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionClears all warnings reported for thisConnectionobject. After a call to this method, the methodgetWarningsreturnsnulluntil a new warning is reported for thisConnectionobject.- Specified by:
clearWarningsin interfaceConnection- Overrides:
clearWarningsin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Throws:
SQLException- if a database access error occurs
-
isValid
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionReturns true if the connection has not been closed and is still valid. The driver shall submit a query on the connection or use some other mechanism that positively verifies the connection is still valid when this method is called.The query submitted by the driver to validate the connection shall be executed in the context of the current transaction.
- Specified by:
isValidin interfaceConnection- Overrides:
isValidin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
timeout- - The time in seconds to wait for the database operation used to validate the connection to complete. If the timeout period expires before the operation completes, this method returns false. A value of 0 indicates a timeout is not applied to the database operation.- Returns:
- true if the connection is valid, false otherwise
- Throws:
SQLException- if the value supplied fortimeoutis less then 0- See Also:
DatabaseMetaData.getClientInfoProperties()
-
getClientInfo
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionReturns a list containing the name and current value of each client info property supported by the driver. The value of a client info property may be null if the property has not been set and does not have a default value.- Specified by:
getClientInfoin interfaceConnection- Overrides:
getClientInfoin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
- A
Propertiesobject that contains the name and current value of each of the client info properties supported by the driver. - Throws:
SQLException- if the database server returns an error when fetching the client info values from the database or this method is called on a closed connection
-
getClientInfo
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionReturns the value of the client info property specified by name. This method may return null if the specified client info property has not been set and does not have a default value. This method will also return null if the specified client info property name is not supported by the driver.Applications may use the
DatabaseMetaData.getClientInfoPropertiesmethod to determine the client info properties supported by the driver.- Specified by:
getClientInfoin interfaceConnection- Overrides:
getClientInfoin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
name- The name of the client info property to retrieve- Returns:
- The value of the client info property specified
- Throws:
SQLException- if the database server returns an error when fetching the client info value from the database or this method is called on a closed connection- See Also:
DatabaseMetaData.getClientInfoProperties()
-
setClientInfo
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionSets the value of the connection's client info properties. ThePropertiesobject contains the names and values of the client info properties to be set. The set of client info properties contained in the properties list replaces the current set of client info properties on the connection. If a property that is currently set on the connection is not present in the properties list, that property is cleared. Specifying an empty properties list will clear all of the properties on the connection. SeesetClientInfo (String, String)for more information.If an error occurs in setting any of the client info properties, a
SQLClientInfoExceptionis thrown. TheSQLClientInfoExceptioncontains information indicating which client info properties were not set. The state of the client information is unknown because some databases do not allow multiple client info properties to be set atomically. For those databases, one or more properties may have been set before the error occurred.- Specified by:
setClientInfoin interfaceConnection- Overrides:
setClientInfoin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
properties- the list of client info properties to set- Throws:
SQLClientInfoException- if the database server returns an error while setting the clientInfo values on the database server or this method is called on a closed connection- See Also:
setClientInfo(String, String)
-
setClientInfo
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionSets the value of the client info property specified by name to the value specified by value.Applications may use the
DatabaseMetaData.getClientInfoPropertiesmethod to determine the client info properties supported by the driver and the maximum length that may be specified for each property.The driver stores the value specified in a suitable location in the database. For example in a special register, session parameter, or system table column. For efficiency the driver may defer setting the value in the database until the next time a statement is executed or prepared. Other than storing the client information in the appropriate place in the database, these methods shall not alter the behavior of the connection in anyway. The values supplied to these methods are used for accounting, diagnostics and debugging purposes only.
The driver shall generate a warning if the client info name specified is not recognized by the driver.
If the value specified to this method is greater than the maximum length for the property the driver may either truncate the value and generate a warning or generate a
SQLClientInfoException. If the driver generates aSQLClientInfoException, the value specified was not set on the connection.The following are standard client info properties. Drivers are not required to support these properties however if the driver supports a client info property that can be described by one of the standard properties, the standard property name should be used.
- ApplicationName - The name of the application currently utilizing the connection
- ClientUser - The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection.
- ClientHostname - The hostname of the computer the application using the connection is running on.
- Specified by:
setClientInfoin interfaceConnection- Overrides:
setClientInfoin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
name- The name of the client info property to setvalue- The value to set the client info property to. If the value is null, the current value of the specified property is cleared.- Throws:
SQLClientInfoException- if the database server returns an error while setting the client info value on the database server or this method is called on a closed connection
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Overrides:
setNetworkTimeoutin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Throws:
SQLException
-
setCatalog
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionSets the given catalog name in order to select a subspace of thisConnectionobject's database in which to work.If the driver does not support catalogs, it will silently ignore this request.
- Specified by:
setCatalogin interfaceConnection- Overrides:
setCatalogin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Parameters:
catalog- the name of a catalog (subspace in thisConnectionobject's database) in which to work- Throws:
SQLException- if a database access error occurs- See Also:
AbstractConnection.getCatalog()
-
setSchema
- Specified by:
setSchemain interfaceConnection- Overrides:
setSchemain classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Throws:
SQLException
-
isClosed
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnectionRetrieves whether thisConnectionobject has been closed. A connection is closed if the methodclosehas been called on it or if certain fatal errors have occurred. This method is guaranteed to returntrueonly when it is called after the methodConnection.closehas been called.This method generally cannot be called to determine whether a connection to a database is valid or invalid. A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted.
- Specified by:
isClosedin interfaceConnection- Overrides:
isClosedin classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection- Returns:
trueif thisConnectionobject is closed;falseif it is still open- Throws:
SQLException- if a database access error occurs
-
getConnectionInfo
Gets all info of thisAceQLConnectioninstance- Returns:
- all info of this
AceQLConnectioninstance
-
toString
-