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.
Blob
updates.Blob
reads.- Transaction through
commit
androllback
orders.
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 the AceQL JDBC Driver
for more info: AceQLDriver
.
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
AtomicInteger
that represents the Blob/Clob transfer progress between 0 and 100. - An
AtomicBoolean
that 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_VERSION
Fields 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 void
clearWarnings()
Clears all warnings reported for thisConnection
object.Connection
clone()
void
close()
Releases thisConnection
object's database and JDBC resources immediately instead of waiting for them to be automatically released.void
commit()
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by thisConnection
object.Blob
createBlob()
Constructs an object that implements theBlob
interface.CallableServerQuery
createCallableServerQuery()
Creates aCallableServerQuery
object for calling a remoteServerQueryExecutor
implementation.Clob
createClob()
Constructs an object that implements theClob
interface.Statement
createStatement()
Creates aStatement
object for sending SQL statements to the database.Statement
createStatement(int resultSetType, int resultSetConcurrency)
Creates aStatement
object that will generateResultSet
objects with the given type and concurrency.Statement
createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Creates aStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability.boolean
getAutoCommit()
Retrieves the current auto-commit mode for thisConnection
object.AtomicBoolean
getCancelled()
Returns the cancelled value set by the progress indicatorString
getCatalog()
Retrieves thisConnection
object's current catalog name.Properties
getClientInfo()
Returns a list containing the name and current value of each client info property supported by the driver.String
getClientInfo(String name)
Returns the value of the client info property specified by name.String
getClientVersion()
Returns the SDK current Version.ConnectionInfo
getConnectionInfo()
Gets all info of thisAceQLConnection
instanceDatabaseInfo
getDatabaseInfo()
A shortcut to remote database metadata which returns remote database and remote JDBC Driver main info.int
getHoldability()
Retrieves the current holdability ofResultSet
objects created using thisConnection
object.LimitsInfo
getLimitsInfo()
Gives info of limits defined on server side.DatabaseMetaData
getMetaData()
Retrieves aDatabaseMetaData
object that contains metadata about the database to which thisConnection
object represents a connection.AtomicInteger
getProgress()
Returns the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100RemoteDatabaseMetaData
getRemoteDatabaseMetaData()
Returns a RemoteDatabaseMetaData instance in order to retrieve metadata info for all client SDKs.String
getSchema()
String
getServerVersion()
Returns the server product versionint
getTransactionIsolation()
Retrieves thisConnection
object's current transaction isolation level.SQLWarning
getWarnings()
Retrieves the first warning reported by calls on thisConnection
object.boolean
isClosed()
Retrieves whether thisConnection
object has been closed.boolean
isReadOnly()
Retrieves whether thisConnection
object is in read-only mode.boolean
isValid(int timeout)
Returns true if the connection has not been closed and is still valid.void
logout()
Calls /logout AceQL HTTP API on server side.CallableStatement
prepareCall(String sql)
Creates aCallableStatement
object for calling database stored procedures.PreparedStatement
prepareStatement(String sql)
Creates aPreparedStatement
object for sending parameterized SQL statements to the database.PreparedStatement
prepareStatement(String sql, int autoGeneratedKeys)
Creates a defaultPreparedStatement
object that has the capability to retrieve auto-generated keys.PreparedStatement
prepareStatement(String sql, int[] columnIndexes)
Creates a defaultPreparedStatement
object capable of returning the auto-generated keys designated by the given array.PreparedStatement
prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
Creates aPreparedStatement
object that will generateResultSet
objects with the given type and concurrency.PreparedStatement
prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Creates aPreparedStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability.PreparedStatement
prepareStatement(String sql, String[] columnNames)
Creates a defaultPreparedStatement
object capable of returning the auto-generated keys designated by the given array.void
releaseSavepoint(Savepoint savepoint)
Removes the givenSavepoint
object from the current transaction.void
rollback()
Undoes all changes made in the current transaction and releases any database locks currently held by thisConnection
object.void
rollback(Savepoint savepoint)
Undoes all changes made after the givenSavepoint
object was set.void
setAutoCommit(boolean autoCommit)
Sets this connection's auto-commit mode to the given state.void
setCancelled(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.void
setCatalog(String catalog)
Sets the given catalog name in order to select a subspace of thisConnection
object's database in which to work.void
setClientInfo(String name, String value)
Sets the value of the client info property specified by name to the value specified by value.void
setClientInfo(Properties properties)
Sets the value of the connection's client info properties.void
setHoldability(int holdability)
Changes the holdability ofResultSet
objects created using thisConnection
object to the given holdability.void
setNetworkTimeout(Executor arg0, int arg1)
void
setProgress(AtomicInteger progress)
Sets the sharable progress variable that will store Blob/Clob upload or download progress between 0 and 100.void
setReadOnly(boolean readOnly)
Puts this connection in read-only mode as a hint to the driver to enable database optimizations.Savepoint
setSavepoint()
Creates an unnamed savepoint in the current transaction and returns the newSavepoint
object that represents it.Savepoint
setSavepoint(String name)
Creates a savepoint with the given name in the current transaction and returns the newSavepoint
object that represents it.void
setSchema(String arg0)
void
setTransactionIsolation(int level)
Attempts to change the transaction isolation level for thisConnection
object to the one given.String
toString()
Methods inherited from class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
abort, createArrayOf, createNClob, createSQLXML, createStruct, getNetworkTimeout, getTypeMap, isWrapperFor, nativeSQL, prepareCall, prepareCall, setTypeMap, unwrap
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.sql.Connection
abort, beginRequest, createArrayOf, createNClob, createSQLXML, createStruct, endRequest, getNetworkTimeout, getTypeMap, nativeSQL, prepareCall, prepareCall, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTypeMap
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Method Details
-
createBlob
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Constructs an object that implements theBlob
interface. The object returned initially contains no data. ThesetBinaryStream
andsetBytes
methods of theBlob
interface may be used to add data to theBlob
.- Specified by:
createBlob
in interfaceConnection
- Overrides:
createBlob
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- An object that implements the
Blob
interface - Throws:
SQLException
- if an object that implements theBlob
interface 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
-
createClob
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Constructs an object that implements theClob
interface. The object returned initially contains no data. ThesetAsciiStream
,setCharacterStream
andsetString
methods of theClob
interface may be used to add data to theClob
.- Specified by:
createClob
in interfaceConnection
- Overrides:
createClob
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- An object that implements the
Clob
interface - Throws:
SQLException
- if an object that implements theClob
interface 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.AbstractConnection
Retrieves aDatabaseMetaData
object that contains metadata about the database to which thisConnection
object 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:
getMetaData
in interfaceConnection
- Overrides:
getMetaData
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- a
DatabaseMetaData
object for thisConnection
object - 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.AbstractConnection
Releases thisConnection
object's database and JDBC resources immediately instead of waiting for them to be automatically released.Calling the method
close
on aConnection
object that is already closed is a no-op.Note: A
Connection
object is automatically closed when it is garbage collected. Certain fatal errors also close aConnection
object.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in 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.AbstractConnection
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by thisConnection
object. This method should be used only when auto-commit mode has been disabled.- Specified by:
commit
in interfaceConnection
- Overrides:
commit
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Throws:
SQLException
- if a database access error occurs or thisConnection
object is in auto-commit mode- See Also:
AbstractConnection.setAutoCommit(boolean)
-
rollback
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Undoes all changes made in the current transaction and releases any database locks currently held by thisConnection
object. This method should be used only when auto-commit mode has been disabled.- Specified by:
rollback
in interfaceConnection
- Overrides:
rollback
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Throws:
SQLException
- if a database access error occurs or thisConnection
object is in auto-commit mode- See Also:
AbstractConnection.setAutoCommit(boolean)
-
setSavepoint
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates an unnamed savepoint in the current transaction and returns the newSavepoint
object that represents it.- Specified by:
setSavepoint
in interfaceConnection
- Overrides:
setSavepoint
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- the new
Savepoint
object - Throws:
SQLException
- if a database access error occurs or thisConnection
object is currently in auto-commit mode- See Also:
Savepoint
-
setSavepoint
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates a savepoint with the given name in the current transaction and returns the newSavepoint
object that represents it.- Specified by:
setSavepoint
in interfaceConnection
- Overrides:
setSavepoint
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
name
- aString
containing the name of the savepoint- Returns:
- the new
Savepoint
object - Throws:
SQLException
- if a database access error occurs or thisConnection
object is currently in auto-commit mode- See Also:
Savepoint
-
rollback
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Undoes all changes made after the givenSavepoint
object was set.This method should be used only when auto-commit has been disabled.
- Specified by:
rollback
in interfaceConnection
- Overrides:
rollback
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
savepoint
- theSavepoint
object to roll back to- Throws:
SQLException
- if a database access error occurs, theSavepoint
object is no longer valid, or thisConnection
object is currently in auto-commit mode- See Also:
Savepoint
,AbstractConnection.rollback()
-
releaseSavepoint
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Removes the givenSavepoint
object from the current transaction. Any reference to the savepoint after it have been removed will cause anSQLException
to be thrown.- Specified by:
releaseSavepoint
in interfaceConnection
- Overrides:
releaseSavepoint
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
savepoint
- theSavepoint
object to be removed- Throws:
SQLException
- if a database access error occurs or the givenSavepoint
object is not a valid savepoint in the current transaction
-
setTransactionIsolation
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Attempts to change the transaction isolation level for thisConnection
object to the one given. The constants defined in the interfaceConnection
are the possible transaction isolation levels.Note: If this method is called during a transaction, the result is implementation-defined.
- Specified by:
setTransactionIsolation
in interfaceConnection
- Overrides:
setTransactionIsolation
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
level
- one of the followingConnection
constants:Connection.TRANSACTION_READ_UNCOMMITTED
,Connection.TRANSACTION_READ_COMMITTED
,Connection.TRANSACTION_REPEATABLE_READ
, orConnection.TRANSACTION_SERIALIZABLE
. (Note thatConnection.TRANSACTION_NONE
cannot 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 theConnection
constants- See Also:
DatabaseMetaData.supportsTransactionIsolationLevel(int)
,AbstractConnection.getTransactionIsolation()
-
setHoldability
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Changes the holdability ofResultSet
objects created using thisConnection
object to the given holdability.- Specified by:
setHoldability
in interfaceConnection
- Overrides:
setHoldability
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
holdability
- aResultSet
holdability constant; one ofResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
- Throws:
SQLException
- if a database access occurs, the given parameter is not aResultSet
constant 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.AbstractConnection
Sets 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 methodcommit
or 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
ResultSet
object, the statement completes when the last row of theResultSet
object has been retrieved or theResultSet
object 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:
setAutoCommit
in interfaceConnection
- Overrides:
setAutoCommit
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
autoCommit
-true
to enable auto-commit mode;false
to 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.AbstractConnection
Retrieves the current auto-commit mode for thisConnection
object.- Specified by:
getAutoCommit
in interfaceConnection
- Overrides:
getAutoCommit
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- the current state of this
Connection
object'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.AbstractConnection
Puts 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:
setReadOnly
in interfaceConnection
- Overrides:
setReadOnly
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
readOnly
-true
enables read-only mode;false
disables 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.AbstractConnection
Retrieves whether thisConnection
object is in read-only mode.- Specified by:
isReadOnly
in interfaceConnection
- Overrides:
isReadOnly
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
true
if thisConnection
object is read-only;false
otherwise- Throws:
SQLException
- if a database access error occurs
-
getHoldability
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Retrieves the current holdability ofResultSet
objects created using thisConnection
object.- Specified by:
getHoldability
in interfaceConnection
- Overrides:
getHoldability
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- the holdability, one of
ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.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.AbstractConnection
Retrieves thisConnection
object's current transaction isolation level.- Specified by:
getTransactionIsolation
in interfaceConnection
- Overrides:
getTransactionIsolation
in 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.AbstractConnection
Retrieves thisConnection
object's current catalog name.- Specified by:
getCatalog
in interfaceConnection
- Overrides:
getCatalog
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- the current catalog name or
null
if there is none - Throws:
SQLException
- if a database access error occurs- See Also:
AbstractConnection.setCatalog(java.lang.String)
-
getSchema
- Specified by:
getSchema
in interfaceConnection
- Overrides:
getSchema
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Throws:
SQLException
-
createCallableServerQuery
Creates aCallableServerQuery
object for calling a remoteServerQueryExecutor
implementation.- Returns:
- a new default
CallableServerQuery
object
-
createStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates aStatement
object for sending SQL statements to the database. SQL statements without parameters are normally executed usingStatement
objects. If the same SQL statement is executed many times, it may be more efficient to use aPreparedStatement
object.Result sets created using the returned
Statement
object will by default be typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
.- Specified by:
createStatement
in interfaceConnection
- Overrides:
createStatement
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- a new default
Statement
object - Throws:
SQLException
- if a database access error occurs
-
createStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates aStatement
object that will generateResultSet
objects with the given type and concurrency. This method is the same as thecreateStatement
method above, but it allows the default result set type and concurrency to be overridden.- Specified by:
createStatement
in interfaceConnection
- Overrides:
createStatement
in 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_SENSITIVE
resultSetConcurrency
- a concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
- Returns:
- a new
Statement
object that will generateResultSet
objects with the given type and concurrency - Throws:
SQLException
- if a database access error occurs or the given parameters are notResultSet
constants indicating type and concurrency
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates aStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability. This method is the same as thecreateStatement
method above, but it allows the default result set type, concurrency, and holdability to be overridden.- Specified by:
createStatement
in interfaceConnection
- Overrides:
createStatement
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
resultSetType
- one of the followingResultSet
constants:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- one of the followingResultSet
constants:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
- Returns:
- a new
Statement
object that will generateResultSet
objects with the given type, concurrency, and holdability - See Also:
ResultSet
-
prepareStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates aPreparedStatement
object for sending parameterized SQL statements to the database.A SQL statement with or without IN parameters can be pre-compiled and stored in a
PreparedStatement
object. This object can then be used to efficiently execute this statement multiple times.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 thePreparedStatement
object is executed. This has no direct effect on users; however, it does affect which methods throw certainSQLException
objects.Result sets created using the returned
PreparedStatement
object will by default be typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
.- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in 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
PreparedStatement
object 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.AbstractConnection
Creates aPreparedStatement
object that will generateResultSet
objects with the given type and concurrency. This method is the same as theprepareStatement
method above, but it allows the default result set type and concurrency to be overridden.- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
sql
- aString
object 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_SENSITIVE
resultSetConcurrency
- a concurrency type; one ofResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
- Returns:
- a new PreparedStatement object containing the pre-compiled SQL
statement that will produce
ResultSet
objects with the given type and concurrency - Throws:
SQLException
- if a database access error occurs or the given parameters are notResultSet
constants 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.AbstractConnection
Creates aPreparedStatement
object that will generateResultSet
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.- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
sql
- aString
object that is the SQL statement to be sent to the database; may contain one or more ? IN parametersresultSetType
- one of the followingResultSet
constants:ResultSet.TYPE_FORWARD_ONLY
,ResultSet.TYPE_SCROLL_INSENSITIVE
, orResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency
- one of the followingResultSet
constants:ResultSet.CONCUR_READ_ONLY
orResultSet.CONCUR_UPDATABLE
resultSetHoldability
- one of the followingResultSet
constants:ResultSet.HOLD_CURSORS_OVER_COMMIT
orResultSet.CLOSE_CURSORS_AT_COMMIT
- Returns:
- a new
PreparedStatement
object, containing the pre-compiled SQL statement, that will generateResultSet
objects with the given type, concurrency, and holdability - Throws:
SQLException
- if a database access error occurs or the given parameters are notResultSet
constants indicating type, concurrency, and holdability- See Also:
ResultSet
-
prepareStatement
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Creates a defaultPreparedStatement
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 anINSERT
statement, 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
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 thePreparedStatement
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 typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
. The holdability of the created result sets can be determined by callingAbstractConnection.getHoldability()
.- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in 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_KEYS
orStatement.NO_GENERATED_KEYS
- Returns:
- a new
PreparedStatement
object, 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 aStatement
constant 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.AbstractConnection
Creates a defaultPreparedStatement
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 anINSERT
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 thePreparedStatement
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 typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
.- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in 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
PreparedStatement
object, 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.AbstractConnection
Creates a defaultPreparedStatement
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 anINSERT
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 thePreparedStatement
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 typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
.- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in 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
PreparedStatement
object, 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.AbstractConnection
Creates aCallableStatement
object for calling database stored procedures. TheCallableStatement
object 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
prepareCall
is done; others may wait until theCallableStatement
object is executed. This has no direct effect on users; however, it does affect which method throws certain SQLExceptions.Result sets created using the returned
CallableStatement
object will by default be typeTYPE_FORWARD_ONLY
and have a concurrency level ofCONCUR_READ_ONLY
.- Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in 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
CallableStatement
object 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.AbstractConnection
Retrieves the first warning reported by calls on thisConnection
object. If there is more than one warning, subsequent warnings will be chained to the first one and can be retrieved by calling the methodSQLWarning.getNextWarning
on the warning that was retrieved previously.This method may not be called on a closed connection; doing so will cause an
SQLException
to be thrown.Note: Subsequent warnings will be chained to this SQLWarning.
- Specified by:
getWarnings
in interfaceConnection
- Overrides:
getWarnings
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- the first
SQLWarning
object ornull
if 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
-
getDatabaseInfo
A shortcut to remote database metadata which returns remote database and remote JDBC Driver main info.- Returns:
- remote database and JDBC Driver main info.
- Throws:
SQLException
- if any Exception occurs
-
getLimitsInfo
Gives info of limits defined on server side.- Returns:
- Gives info of limits defined on server side.o.
- Throws:
SQLException
- 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.AbstractConnection
Clears all warnings reported for thisConnection
object. After a call to this method, the methodgetWarnings
returnsnull
until a new warning is reported for thisConnection
object.- Specified by:
clearWarnings
in interfaceConnection
- Overrides:
clearWarnings
in 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.AbstractConnection
Returns 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:
isValid
in interfaceConnection
- Overrides:
isValid
in 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 fortimeout
is less then 0- See Also:
DatabaseMetaData.getClientInfoProperties()
-
getClientInfo
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Returns 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:
getClientInfo
in interfaceConnection
- Overrides:
getClientInfo
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
- A
Properties
object 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.AbstractConnection
Returns 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.getClientInfoProperties
method to determine the client info properties supported by the driver.- Specified by:
getClientInfo
in interfaceConnection
- Overrides:
getClientInfo
in 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.AbstractConnection
Sets the value of the connection's client info properties. TheProperties
object 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
SQLClientInfoException
is thrown. TheSQLClientInfoException
contains 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:
setClientInfo
in interfaceConnection
- Overrides:
setClientInfo
in 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.AbstractConnection
Sets the value of the client info property specified by name to the value specified by value.Applications may use the
DatabaseMetaData.getClientInfoProperties
method 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:
setClientInfo
in interfaceConnection
- Overrides:
setClientInfo
in 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:
setNetworkTimeout
in interfaceConnection
- Overrides:
setNetworkTimeout
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Throws:
SQLException
-
setCatalog
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Sets the given catalog name in order to select a subspace of thisConnection
object's database in which to work.If the driver does not support catalogs, it will silently ignore this request.
- Specified by:
setCatalog
in interfaceConnection
- Overrides:
setCatalog
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Parameters:
catalog
- the name of a catalog (subspace in thisConnection
object's database) in which to work- Throws:
SQLException
- if a database access error occurs- See Also:
AbstractConnection.getCatalog()
-
setSchema
- Specified by:
setSchema
in interfaceConnection
- Overrides:
setSchema
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Throws:
SQLException
-
isClosed
Description copied from class:com.aceql.jdbc.commons.main.abstracts.AbstractConnection
Retrieves whether thisConnection
object has been closed. A connection is closed if the methodclose
has been called on it or if certain fatal errors have occurred. This method is guaranteed to returntrue
only when it is called after the methodConnection.close
has 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:
isClosed
in interfaceConnection
- Overrides:
isClosed
in classcom.aceql.jdbc.commons.main.abstracts.AbstractConnection
- Returns:
true
if thisConnection
object is closed;false
if it is still open- Throws:
SQLException
- if a database access error occurs
-
getConnectionInfo
Gets all info of thisAceQLConnection
instance- Returns:
- all info of this
AceQLConnection
instance
-
toString
-