Class AceQLConnection

java.lang.Object
com.aceql.jdbc.commons.main.abstracts.AbstractConnection
com.aceql.jdbc.commons.AceQLConnection
All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable, Connection, Wrapper

public class AceQLConnection
extends com.aceql.jdbc.commons.main.abstracts.AbstractConnection
implements Connection, Cloneable, Closeable
Provides a 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 and rollback 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:

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:

 // 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 the source code of SqlProgressMonitorDemo.java that demonstrates the use of atomic variables when inserting a Blob.

See also AceQLBlob that describes how to use Blobs.
Author:
Nicolas de Pomereu
  • Method Details

    • createBlob

      public Blob createBlob() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Constructs an object that implements the Blob interface. The object returned initially contains no data. The setBinaryStream and setBytes methods of the Blob interface may be used to add data to the Blob.
      Specified by:
      createBlob in interface Connection
      Overrides:
      createBlob in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      An object that implements the Blob interface
      Throws:
      SQLException - if an object that implements the Blob 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

      public Clob createClob() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Constructs an object that implements the Clob interface. The object returned initially contains no data. The setAsciiStream, setCharacterStream and setString methods of the Clob interface may be used to add data to the Clob.
      Specified by:
      createClob in interface Connection
      Overrides:
      createClob in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      An object that implements the Clob interface
      Throws:
      SQLException - if an object that implements the Clob 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

      public DatabaseMetaData getMetaData() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves a DatabaseMetaData object that contains metadata about the database to which this Connection 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 interface Connection
      Overrides:
      getMetaData in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      a DatabaseMetaData object for this Connection object
      Throws:
      SQLException - if a database access error occurs
    • getRemoteDatabaseMetaData

      public RemoteDatabaseMetaData 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 this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released.

      Calling the method close on a Connection 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 a Connection object.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Connection
      Overrides:
      close in class com.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

      public void commit() throws SQLException
      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 this Connection object. This method should be used only when auto-commit mode has been disabled.
      Specified by:
      commit in interface Connection
      Overrides:
      commit in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Throws:
      SQLException - if a database access error occurs or this Connection object is in auto-commit mode
      See Also:
      AbstractConnection.setAutoCommit(boolean)
    • rollback

      public void rollback() throws SQLException
      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 this Connection object. This method should be used only when auto-commit mode has been disabled.
      Specified by:
      rollback in interface Connection
      Overrides:
      rollback in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Throws:
      SQLException - if a database access error occurs or this Connection object is in auto-commit mode
      See Also:
      AbstractConnection.setAutoCommit(boolean)
    • setSavepoint

      public Savepoint setSavepoint() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.
      Specified by:
      setSavepoint in interface Connection
      Overrides:
      setSavepoint in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      the new Savepoint object
      Throws:
      SQLException - if a database access error occurs or this Connection object is currently in auto-commit mode
      See Also:
      Savepoint
    • setSavepoint

      public Savepoint setSavepoint​(String name) throws SQLException
      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 new Savepoint object that represents it.
      Specified by:
      setSavepoint in interface Connection
      Overrides:
      setSavepoint in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      name - a String containing the name of the savepoint
      Returns:
      the new Savepoint object
      Throws:
      SQLException - if a database access error occurs or this Connection object is currently in auto-commit mode
      See Also:
      Savepoint
    • rollback

      public void rollback​(Savepoint savepoint) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Undoes all changes made after the given Savepoint object was set.

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

      Specified by:
      rollback in interface Connection
      Overrides:
      rollback in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      savepoint - the Savepoint object to roll back to
      Throws:
      SQLException - if a database access error occurs, the Savepoint object is no longer valid, or this Connection object is currently in auto-commit mode
      See Also:
      Savepoint, AbstractConnection.rollback()
    • releaseSavepoint

      public void releaseSavepoint​(Savepoint savepoint) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Removes the given Savepoint object from the current transaction. Any reference to the savepoint after it have been removed will cause an SQLException to be thrown.
      Specified by:
      releaseSavepoint in interface Connection
      Overrides:
      releaseSavepoint in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      savepoint - the Savepoint object to be removed
      Throws:
      SQLException - if a database access error occurs or the given Savepoint object is not a valid savepoint in the current transaction
    • setTransactionIsolation

      public void setTransactionIsolation​(int level) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Attempts to change the transaction isolation level for this Connection object to the one given. The constants defined in the interface Connection are the possible transaction isolation levels.

      Note: If this method is called during a transaction, the result is implementation-defined.

      Specified by:
      setTransactionIsolation in interface Connection
      Overrides:
      setTransactionIsolation in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      level - one of the following Connection constants: Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or Connection.TRANSACTION_SERIALIZABLE. (Note that Connection.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 the Connection constants
      See Also:
      DatabaseMetaData.supportsTransactionIsolationLevel(int), AbstractConnection.getTransactionIsolation()
    • setHoldability

      public void setHoldability​(int holdability) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Changes the holdability of ResultSet objects created using this Connection object to the given holdability.
      Specified by:
      setHoldability in interface Connection
      Overrides:
      setHoldability in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      holdability - a ResultSet holdability constant; one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
      Throws:
      SQLException - if a database access occurs, the given parameter is not a ResultSet constant indicating holdability, or the given holdability is not supported
      See Also:
      AbstractConnection.getHoldability(), ResultSet
    • setAutoCommit

      public void setAutoCommit​(boolean autoCommit) throws SQLException
      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 method commit or the method rollback . By default, new connections are in auto-commit mode.

      The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet object, the statement completes when the last row of the ResultSet object has been retrieved or the ResultSet 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 interface Connection
      Overrides:
      setAutoCommit in class com.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

      public boolean getAutoCommit() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves the current auto-commit mode for this Connection object.
      Specified by:
      getAutoCommit in interface Connection
      Overrides:
      getAutoCommit in class com.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

      public void setReadOnly​(boolean readOnly) throws SQLException
      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 interface Connection
      Overrides:
      setReadOnly in class com.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

      public boolean isReadOnly() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves whether this Connection object is in read-only mode.
      Specified by:
      isReadOnly in interface Connection
      Overrides:
      isReadOnly in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      true if this Connection object is read-only; false otherwise
      Throws:
      SQLException - if a database access error occurs
    • getHoldability

      public int getHoldability() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves the current holdability of ResultSet objects created using this Connection object.
      Specified by:
      getHoldability in interface Connection
      Overrides:
      getHoldability in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      the holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
      Throws:
      SQLException - if a database access occurs
      See Also:
      AbstractConnection.setHoldability(int), ResultSet
    • getTransactionIsolation

      public int getTransactionIsolation() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves this Connection object's current transaction isolation level.
      Specified by:
      getTransactionIsolation in interface Connection
      Overrides:
      getTransactionIsolation in class com.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, or Connection.TRANSACTION_NONE.
      Throws:
      SQLException - if a database access error occurs
      See Also:
      AbstractConnection.setTransactionIsolation(int)
    • getCatalog

      public String getCatalog() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves this Connection object's current catalog name.
      Specified by:
      getCatalog in interface Connection
      Overrides:
      getCatalog in class com.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

      public String getSchema() throws SQLException
      Specified by:
      getSchema in interface Connection
      Overrides:
      getSchema in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Throws:
      SQLException
    • createCallableServerQuery

      public CallableServerQuery createCallableServerQuery()
      Creates a CallableServerQuery object for calling a remote ServerQueryExecutor implementation.
      Returns:
      a new default CallableServerQuery object
    • createStatement

      public Statement createStatement() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a Statement object for sending SQL statements to the database. SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it may be more efficient to use a PreparedStatement object.

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

      Specified by:
      createStatement in interface Connection
      Overrides:
      createStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      a new default Statement object
      Throws:
      SQLException - if a database access error occurs
    • createStatement

      public Statement createStatement​(int resultSetType, int resultSetConcurrency) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the createStatement method above, but it allows the default result set type and concurrency to be overridden.
      Specified by:
      createStatement in interface Connection
      Overrides:
      createStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
      resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
      Returns:
      a new Statement object that will generate ResultSet objects with the given type and concurrency
      Throws:
      SQLException - if a database access error occurs or the given parameters are not ResultSet 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 a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability. This method is the same as the createStatement method above, but it allows the default result set type, concurrency, and holdability to be overridden.
      Specified by:
      createStatement in interface Connection
      Overrides:
      createStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      resultSetType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
      resultSetConcurrency - one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
      resultSetHoldability - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
      Returns:
      a new Statement object that will generate ResultSet objects with the given type, concurrency, and holdability
      See Also:
      ResultSet
    • prepareStatement

      public PreparedStatement prepareStatement​(String sql) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a PreparedStatement 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 the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLException objects.

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

      Specified by:
      prepareStatement in interface Connection
      Overrides:
      prepareStatement in class com.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 SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareStatement method above, but it allows the default result set type and concurrency to be overridden.
      Specified by:
      prepareStatement in interface Connection
      Overrides:
      prepareStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      sql - a String object that is the SQL statement to be sent to the database; may contain one or more ? IN parameters
      resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
      resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.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 not ResultSet constants indicating type and concurrency
    • prepareStatement

      public PreparedStatement prepareStatement​(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.

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

      Specified by:
      prepareStatement in interface Connection
      Overrides:
      prepareStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      sql - a String object that is the SQL statement to be sent to the database; may contain one or more ? IN parameters
      resultSetType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
      resultSetConcurrency - one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
      resultSetHoldability - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
      Returns:
      a new PreparedStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
      Throws:
      SQLException - if a database access error occurs or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
      See Also:
      ResultSet
    • prepareStatement

      public PreparedStatement prepareStatement​(String sql, int autoGeneratedKeys) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an INSERT statement, 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 the PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

      Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. The holdability of the created result sets can be determined by calling AbstractConnection.getHoldability().

      Specified by:
      prepareStatement in interface Connection
      Overrides:
      prepareStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      sql - an SQL statement that may contain one or more '?' IN parameter placeholders
      autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
      Returns:
      a new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys
      Throws:
      SQLException - if a database access error occurs, this method is called on a closed connection or the given parameter is not a Statement constant indicating whether auto-generated keys should be returned
      SQLFeatureNotSupportedException - if the JDBC driver does not support this method with a constant of Statement.RETURN_GENERATED_KEYS
    • prepareStatement

      public PreparedStatement prepareStatement​(String sql, int[] columnIndexes) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. This array is ignored if the SQL statement is not an INSERT statement.

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

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

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

      Specified by:
      prepareStatement in interface Connection
      Overrides:
      prepareStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      sql - an SQL statement that may contain one or more '?' IN parameter placeholders
      columnIndexes - an array of column indexes indicating the columns that should be returned from the inserted row or rows
      Returns:
      a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes
      Throws:
      SQLException - if a database access error occurs
    • prepareStatement

      public PreparedStatement prepareStatement​(String sql, String[] columnNames) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. This array is ignored if the SQL statement is not an INSERT statement.

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

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

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

      Specified by:
      prepareStatement in interface Connection
      Overrides:
      prepareStatement in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      sql - an SQL statement that may contain one or more '?' IN parameter placeholders
      columnNames - an array of column names indicating the columns that should be returned from the inserted row or rows
      Returns:
      a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names
      Throws:
      SQLException - if a database access error occurs
    • prepareCall

      public CallableStatement prepareCall​(String sql) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Creates a CallableStatement object for calling database stored procedures. The CallableStatement 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 the CallableStatement 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 type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

      Specified by:
      prepareCall in interface Connection
      Overrides:
      prepareCall in class com.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

      public SQLWarning getWarnings() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves the first warning reported by calls on this Connection object. If there is more than one warning, subsequent warnings will be chained to the first one and can be retrieved by calling the method SQLWarning.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 interface Connection
      Overrides:
      getWarnings in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      the first SQLWarning object or null 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

      public Connection clone()
    • getClientVersion

      public String getClientVersion()
      Returns the SDK current Version.
      Returns:
      the SDK current Version
    • getServerVersion

      public String getServerVersion() throws AceQLException
      Returns the server product version
      Returns:
      the server product version
      Throws:
      AceQLException - if any Exception occurs
    • getDatabaseInfo

      public DatabaseInfo getDatabaseInfo() throws SQLException
      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

      public LimitsInfo getLimitsInfo() throws SQLException
      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

      public AtomicBoolean getCancelled()
      Returns the cancelled value set by the progress indicator
      Returns:
      the cancelled value set by the progress indicator
    • getProgress

      public AtomicInteger 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

      public 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.
      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

      public void setProgress​(AtomicInteger progress)
      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

      public void clearWarnings() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Clears all warnings reported for this Connection object. After a call to this method, the method getWarnings returns null until a new warning is reported for this Connection object.
      Specified by:
      clearWarnings in interface Connection
      Overrides:
      clearWarnings in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Throws:
      SQLException - if a database access error occurs
    • isValid

      public boolean isValid​(int timeout) throws SQLException
      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 interface Connection
      Overrides:
      isValid in class com.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 for timeout is less then 0
      See Also:
      DatabaseMetaData.getClientInfoProperties()
    • getClientInfo

      public Properties getClientInfo() throws SQLException
      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 interface Connection
      Overrides:
      getClientInfo in class com.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

      public String getClientInfo​(String name) throws SQLException
      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 interface Connection
      Overrides:
      getClientInfo in class com.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

      public void setClientInfo​(Properties properties) throws SQLClientInfoException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Sets the value of the connection's client info properties. The Properties 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. See setClientInfo (String, String) for more information.

      If an error occurs in setting any of the client info properties, a SQLClientInfoException is thrown. The SQLClientInfoException 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 interface Connection
      Overrides:
      setClientInfo in class com.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

      public void setClientInfo​(String name, String value) throws SQLClientInfoException
      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 a SQLClientInfoException, 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 interface Connection
      Overrides:
      setClientInfo in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      name - The name of the client info property to set
      value - 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

      public void setNetworkTimeout​(Executor arg0, int arg1) throws SQLException
      Specified by:
      setNetworkTimeout in interface Connection
      Overrides:
      setNetworkTimeout in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Throws:
      SQLException
    • setCatalog

      public void setCatalog​(String catalog) throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Sets the given catalog name in order to select a subspace of this Connection object's database in which to work.

      If the driver does not support catalogs, it will silently ignore this request.

      Specified by:
      setCatalog in interface Connection
      Overrides:
      setCatalog in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Parameters:
      catalog - the name of a catalog (subspace in this Connection object's database) in which to work
      Throws:
      SQLException - if a database access error occurs
      See Also:
      AbstractConnection.getCatalog()
    • setSchema

      public void setSchema​(String arg0) throws SQLException
      Specified by:
      setSchema in interface Connection
      Overrides:
      setSchema in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Throws:
      SQLException
    • isClosed

      public boolean isClosed() throws SQLException
      Description copied from class: com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Retrieves whether this Connection object has been closed. A connection is closed if the method close has been called on it or if certain fatal errors have occurred. This method is guaranteed to return true only when it is called after the method Connection.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 interface Connection
      Overrides:
      isClosed in class com.aceql.jdbc.commons.main.abstracts.AbstractConnection
      Returns:
      true if this Connection object is closed; false if it is still open
      Throws:
      SQLException - if a database access error occurs
    • getConnectionInfo

      public ConnectionInfo getConnectionInfo()
      Gets all info of this AceQLConnection instance
      Returns:
      all info of this AceQLConnection instance
    • toString

      public String toString()
      Overrides:
      toString in class Object