Top Description Fields Constructors Methods
org.hsqldb.jdbc

public Class JDBCConnection

extends Object
implements Connection
Class Inheritance
All Implemented Interfaces
java.sql.Connection, java.lang.AutoCloseable, java.sql.Wrapper
Known Direct Subclasses
org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
Imports
java.sql.Array, .Blob, .CallableStatement, .Clob, .Connection, .DatabaseMetaData, .NClob, .PreparedStatement, .SQLClientInfoException, .SQLFeatureNotSupportedException, .SQLException, .SQLWarning, .SQLXML, .Savepoint, .Statement, .Struct, java.util.HashMap, .Map, .Properties, .TimeZone, org.hsqldb.ClientConnection, .ClientConnectionHTTP, .DatabaseManager, .DatabaseURL, .HsqlException, .SessionInterface, .SessionInterface.Attributes, org.hsqldb.error.ErrorCode, org.hsqldb.lib.StringUtil, org.hsqldb.persist.HsqlDatabaseProperties, .HsqlProperties, org.hsqldb.result.Result, .ResultConstants, .ResultProperties, org.hsqldb.types.ArrayType, .Type

A connection (session) with a specific database. SQL statements are executed and results are returned within the context of a connection.

A Connection object's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on. This information is obtained with the getMetaData method.

Note

When configuring a Connection, JDBC applications should use the appropriate Connection method such as setAutoCommit or setTransactionIsolation. Applications should not invoke SQL commands directly to change the connection's configuration when there is a JDBC method available. By default a Connection object is in auto-commit mode, which means that it automatically commits changes after executing each statement. If auto-commit mode has been disabled, the method commit must be called explicitly in order to commit changes; otherwise, database changes will not be saved.

A new Connection object created using the JDBC 2.1 core API has an initially empty type map associated with it. A user may enter a custom mapping for a UDT in this type map. When a UDT is retrieved from a data source with the method ResultSet.getObject, the getObject method will check the connection's type map to see if there is an entry for that UDT. If so, the getObject method will map the UDT to the class indicated. If there is no entry, the UDT will be mapped using the standard mapping.

A user may create a new type map, which is a java.util.Map object, make an entry in it, and pass it to the java.sql methods that can perform custom mapping. In this case, the method will use the given type map instead of the one associated with the connection.

For example, the following code fragment specifies that the SQL type ATHLETES will be mapped to the class Athletes in the Java programming language. The code fragment retrieves the type map for the Connection object con, inserts the entry into it, and then sets the type map with the new entry as the connection's type map.

     java.util.Map map = con.getTypeMap();
     map.put("mySchemaName.ATHLETES", Class.forName("Athletes"));
     con.setTypeMap(map);

HSQLDB-Specific Information:

To get a Connection to an HSQLDB database, the following code may be used (updated to reflect the most recent recommendations):
When using HSQLDB, the database connection <url> must start with 'jdbc:hsqldb:'

Since 1.7.2, connection properties (<key-value-pairs>) may be appended to the database connection <url>, using the form:

'<url>[;key=value]*'

Also since 1.7.2, the allowable forms of the HSQLDB database connection <url> have been extended. However, all legacy forms continue to work, with unchanged semantics. The extensions are as described in the following material.


Network Server Database Connections:

The Server database connection <url> takes one of the two following forms:

  1. 'jdbc:hsqldb:hsql://host[:port][/<alias>][<key-value-pairs>]'
  2. 'jdbc:hsqldb:hsqls://host[:port][/<alias>][<key-value-pairs>]' (with TLS).

The WebServer database connection <url> takes one of two following forms:

  1. 'jdbc:hsqldb:http://host[:port][/<alias>][<key-value-pairs>]'
  2. 'jdbc:hsqldb:https://host[:port][/<alias>][<key-value-pairs>]' (with TLS).

In both network server database connection <url> forms, the optional <alias> component is used to identify one of possibly several database instances available at the indicated host and port. If the <alias> component is omitted, then a connection is made to the network server's default database instance, if such an instance is available.

For more information on server configuration regarding mounting multiple databases and assigning them <alias> values, please read the Java API documentation for Server and related chapters in the general documentation, especially the HyperSQL User Guide.


Transient, In-Process Database Connections:

The 100% in-memory (transient, in-process) database connection <url> takes one of the two following forms:

  1. 'jdbc:hsqldb:.[<key-value-pairs>]' (the legacy form, extended)
  2. 'jdbc:hsqldb:mem:<alias>[<key-value-pairs>]' (the new form)

The driver converts the supplied <alias> component to Local.ENGLISH lower case and uses the resulting character sequence as the key used to look up a mem: protocol database instance amongst the collection of all such instances already in existence within the current class loading context in the current JVM. If no such instance exists, one may be automatically created and mapped to the <alias>, as governed by the 'ifexists=true|false' connection property.

The rationale for converting the supplied <alias> component to lower case is to provide consistency with the behavior of res: protocol database connection <url>s, explained further on in this overview.


Persistent, In-Process Database Connections:

The standalone (persistent, in-process) database connection <url> takes one of the three following forms:

  1. 'jdbc:hsqldb:<path>[<key-value-pairs>]' (the legacy form, extended)
  2. 'jdbc:hsqldb:file:<path>[<key-value-pairs>]' (same semantics as the legacy form)
  3. 'jdbc:hsqldb:res:<path>[<key-value-pairs>]' (new form with 'files_in_jar' semantics)

For the persistent, in-process database connection <url>, the <path> component is the path prefix common to all of the files that compose the database.

From 1.7.2, although other files may be involved (such as transient working files and/or TEXT table CSV data source files), the essential set that may, at any particular point in time, compose an HSQLDB database is:

  • <path>.properties
  • <path>.script
  • <path>.log
  • <path>.data
  • <path>.backup
  • <path>.lck

For example: 'jdbc:hsqldb:file:test' connects to a database composed of some subset of the files listed above, where the expansion of <path> is 'test' prefixed with the canonical path of the JVM's effective working directory at the time the designated database is first opened in-process.

Be careful to note that this canonical expansion of <path> is cached by the driver until JVM exit. So, although legacy JVMs tend to fix the reported effective working directory at the one noted upon JVM startup, there is no guarantee that modern JVMs will continue to uphold this behaviour. What this means is there is effectively no guarantee into the future that a relative file: protocol database connection <url> will connect to the same database instance for the life of the JVM. To avoid any future ambiguity issues, it is probably a best practice for clients to attempt to pre-canonicalize the <path> component of file: protocol database connection* <url>s.

Under Windows, 'jdbc:hsqldb:file:c:\databases\test' connects to a database located on drive 'C:' in the directory 'databases', composed of some subset of the files:

C:\
+--databases\
   +--test.properties
   +--test.script
   +--test.log
   +--test.data
   +--test.backup
   +--test.lck
Under most variations of UNIX, 'jdbc:hsqldb:file:/databases/test' connects to a database located in the directory 'databases' directly under root, once again composed of some subset of the files:

+--databases
   +--test.properties
   +--test.script
   +--test.log
   +--test.data
   +--test.backup
   +--test.lck
Some Guidelines:
  1. Both relative and absolute database file paths are supported.
  2. Relative database file paths can be specified in a platform independent manner as: '[dir1/dir2/.../dirn/]<file-name-prefix>'.
  3. Specification of absolute file paths is operating-system specific.
    Please read your OS file system documentation.
  4. Specification of network mounts may be operating-system specific.
    Please read your OS file system documentation.
  5. Special care may be needed w.r.t. file path specifications containing whitespace, mixed-case, special characters and/or reserved file names.
    Please read your OS file system documentation.

Note

HSQLDB creates directories along the file path specified in the persistent, in-process mode database connection <url> form, in the case that they did not already exist.


res: protocol Connections:

The 'jdbc:hsqldb:res:<path>' database connection <url> has different semantics than the 'jdbc:hsqldb:file:<path>' form. The semantics are similar to those of a 'files_readonly' database, but with some additional points to consider.

Specifically, the '<path>' component of a res: protocol database connection <url> is first converted to lower case with Locale.ENGLISH and only then used to obtain resource URL objects, which in turn are used to read the database files as resources on the class path.

Due to lower case conversion by the driver, res: '<path>' components never find jar resources stored with Locale.ENGLISH mixed case paths. The rationale for converting to lower case is that not all pkzip implementations guarantee path case is preserved when archiving resources, and conversion to lower case seems to be the most common occurrence (although there is also no actual guarantee that the conversion is Locale.ENGLISH).

More importantly, res: '<path>' components must point only to resources contained in one or more jars on the class path. That is, only resources having the jar sub-protocol are considered valid.

This restriction is enforced to avoid the unfortunate situation in which, because res: database instances do not create a <path>.lck file (they are strictly files-read-only) and because the <path> components of res: and file: database URIs are not checked for file system equivalence, it is possible for the same database files to be accessed concurrently by both file: and res: database instances. That is, without this restriction, it is possible that <path>.data and <path>.properties file content may be written by a file: database instance without the knowledge or cooperation of a res: database instance open on the same files, potentially resulting in unexpected database errors, inconsistent operation and/or data corruption.

In short, a res: type database connection <url> is designed specifically to connect to a 'files_in_jar' mode database instance, which in turn is designed specifically to operate under Java WebStart and Java Applet configurations, where co-locating the database files in the jars that make up the WebStart application or Applet avoids the need for special security configuration or code signing.

Note

Since it is difficult and often nearly impossible to determine or control at runtime from where all classes are being loaded or which class loader is doing the loading (and hence how relative path specifications are resolved) under 'files_in_jar' semantics, the <path> component of the res: database connection <url> is always taken to be relative to the default package and resource URL resolution is always performed using the ClassLoader that loads the org.hsqldb.persist.Logger class. That is, if the <path> component does not start with '/', then'/' is prepended when obtaining the resource URLs used to read the database files, and only the effective class path of org.hsqldb.persist.Logger's ClassLoader is searched.


For more information about HSQLDB file structure, various database modes and other attributes such as those controlled through the HSQLDB properties files, please read the general documentation, especially the HyperSQL User Guide.

JDBC 4.0 Notes:

Starting with JDBC 4.0 (JDK 1.6), the DriverManager methods getConnection and getDrivers have been enhanced to support the Java Standard Edition Service Provider mechanism. HSQLDB distribution jars containing the Driver implementation also include the file META-INF/services/java.sql.Driver. This file contains the fully qualified class name ('org.hsqldb.jdbc.JDBCDriver') of the HSQLDB implementation of java.sql.Driver.

Hence, under JDBC 4.0 or greater, applications no longer need to explicitly load the HSQLDB JDBC driver using Class.forName(). Of course, existing programs which do load JDBC drivers using Class.forName() will continue to work without modification.


(fredt@users)
(campbell-burnet@users)
Authors
Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
Since
HSQLDB 1.9.0
Version
2.7.3
See Also
JDBCDriver, JDBCStatement, JDBCParameterMetaData, JDBCCallableStatement, JDBCResultSet, JDBCDatabaseMetaData, java.sql.DriverManager, java.sql.Statement, java.sql.ResultSet, java.sql.DatabaseMetaData

Field Summary

Modifier and TypeField and Description
pack-priv HsqlProperties
clientProperties

Properties for the session

pack-priv HsqlProperties
connProperties

Properties for the connection

pack-priv int
incarnation

reuse count in ConnectionPool

pack-priv volatile boolean
is

used

pack-priv boolean
isAllowEmptyBatch

connection URL property allow_empty_batch indicates to accept executeBatch() when the batch is empty

pack-priv boolean
isClosed

Is this connection closed?

pack-priv boolean
isCloseResultSet

connection URL property close_result indicates to close old result when Statement is reused

pack-priv boolean
isDefaultSchema

connection URL property defult_schema for use with OpenOffic indicates to use PUBLIC schema by default

pack-priv boolean
isInternal

Is this an internal connection?

pack-priv boolean
isMemoryLobs

connection URL property memory_lobs indicates to load lobs fully into memory in ResultSet

protected boolean
isNetConn

Is this connection to a network server instance.

pack-priv boolean
isPooled

used by a JDBCPool or other custom ConnectionPool instance

pack-priv boolean
isStoreLiveObject

database URL property hsqldb.live_object indicates to store non-serialized object in OTHER columns

pack-priv boolean
isTranslateTTIType

database property for translation of INTERVAL types to VARCHAR

pack-priv boolean
isUseColumnName

connection URL property use_column_name indicates to return column name in ResultMetadata

pack-priv JDBCConnectionEventListener
poolEventListener

used by a JDBCPool or other custom ConnectionPool instance

private SQLWarning
rootWarning

The first warning in the chain.

private final Object
rootWarning_mutex

Synchronizes concurrent modification of the warning chain

pack-priv int
rsHoldability

Initial holdability

private int
savepointIDSequence

ID sequence for unnamed savepoints

pack-priv SessionInterface
sessionProxy

This connection's interface to the corresponding Session object in the database engine.

pack-priv TimeZone
timeZone

Shared, reused local TimeZone which should not be modified

Constructor Summary

AccessConstructor and Description
public
JDBCConnection(HsqlProperties
A Properties object containing the connection properties
props
)

Constructs a new external Connection to an HSQLDB Database.

public
JDBCConnection(SessionInterface
the Session requesting the construction of this Connection
c
)

Constructs an INTERNAL Connection, using the specified SessionInterface.

public
JDBCConnection(JDBCConnection
the connection
c
,
JDBCConnectionEventListener
the listener
eventListener
)

Constructor for use with connection pooling and XA.

Method Summary

Modifier and TypeMethod and Description
public void
abort(Executor
The Executor implementation which will be used by abort.
executor
)

Implements java.sql.Connection.abort.

Terminates an open connection.

pack-priv void
addWarning(SQLWarning
the SQLWarning to add to the chain
w
)

Adds another SQLWarning to this Connection object's warning chain.

public void
beginRequest()

Overrides default java.sql.Connection.beginRequest.

Hints to the driver that a request, an independent unit of work, is beginning on this connection.

pack-priv synchronized void
checkClosed()

An internal check for closed connections.

public synchronized void
clearWarnings()

Implements java.sql.Connection.clearWarnings.

Clears all warnings reported for this Connection object.

public synchronized void
close()

Implements java.sql.Connection.close.

Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released.

public void
closeFully()

Completely closes a pooled connection

public synchronized void
commit()

Implements java.sql.Connection.commit.

Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this Connection object.

public Array

Returns:

an Array object whose elements map to the specified SQL type
createArrayOf
(String
the SQL name of the type the elements of the array map to. The typeName is a database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This is the value returned by Array.getBaseTypeName
typeName
,
Object[]
the elements that populate the returned object
elements
)

Implements java.sql.Connection.createArrayOf.

Factory method for creating Array objects.

public Blob

Returns:

An object that implements the Blob interface
createBlob
()

Implements java.sql.Connection.createBlob.

Constructs an object that implements the Blob interface.

public Clob

Returns:

An object that implements the Clob interface
createClob
()

Implements java.sql.Connection.createClob.

Constructs an object that implements the Clob interface.

public NClob

Returns:

An object that implements the NClob interface
createNClob
()

Implements java.sql.Connection.createNClob.

Constructs an object that implements the NClob interface.

public SQLXML

Returns:

An object that implements the SQLXML interface
createSQLXML
()

Implements java.sql.Connection.createSQLXML.

Constructs an object that implements the SQLXML interface.

public synchronized Statement

Returns:

a new default Statement object
createStatement
()

Implements java.sql.Connection.createStatement.

Creates a Statement object for sending SQL statements to the database.

public synchronized Statement

Returns:

a new Statement object that will generate ResultSet objects with the given type and concurrency
createStatement
(int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Implements java.sql.Connection.createStatement.

Creates a Statement object that will generate ResultSet objects with the given type and concurrency.

public synchronized Statement

Returns:

a new Statement object that will generate ResultSet objects with the given type, concurrency, and holdability
createStatement
(int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Implements java.sql.Connection.createStatement.

Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.

public Struct

Returns:

a Struct object that maps to the given SQL type and is populated with the given attributes
createStruct
(String
the SQL type name of the SQL structured type that this Struct object maps to. The typeName is the name of a user-defined type that has been defined for this database. It is the value returned by Struct.getSQLTypeName.
typeName
,
Object[]
the attributes that populate the returned object
attributes
)

Implements java.sql.Connection.createStruct.

Factory method for creating Struct objects.

public void
endRequest()

Overrides default java.sql.Connection.endRequest.

Hints to the driver that a request, an independent unit of work, has completed.

public synchronized boolean

Returns:

the current state of this Connection object's auto-commit mode
getAutoCommit
()

Implements java.sql.Connection.getAutoCommit.

Retrieves the current auto-commit mode for this Connection object.

public synchronized String

Returns:

the current catalog name or null if there is none
getCatalog
()

Implements java.sql.Connection.getCatalog.

Retrieves this Connection object's current catalog name.

public String

Returns:

The value of the client info property specified
getClientInfo
(String
The name of the client info property to retrieve
name
)

Implements java.sql.Connection.getClientInfo.

Returns the value of the client info property specified by name.

public Properties

Returns:

A Properties object that contains the name and current value of each of the client info properties supported by the driver.
getClientInfo
()

Implements java.sql.Connection.getClientInfo.

Returns a list containing the name and current value of each client info property supported by the driver.

public HsqlProperties
public synchronized int

Returns:

the holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
getHoldability
()

Implements java.sql.Connection.getHoldability.

Retrieves the current holdability of ResultSet objects created using this Connection object.

public synchronized DatabaseMetaData

Returns:

a DatabaseMetaData object for this Connection object
getMetaData
()

Implements java.sql.Connection.getMetaData.

Retrieves a DatabaseMetaData object that contains metadata about the database to which this Connection object represents a connection.

public int

Returns:

the current timeout limit in milliseconds; zero means there is no limit
getNetworkTimeout
()

Implements java.sql.Connection.getNetworkTimeout.

Retrieves the number of milliseconds the driver will wait for a database request to complete.

pack-priv synchronized int
public String

Returns:

the current schema name or null if there is none
getSchema
()

Implements java.sql.Connection.getSchema.

Retrieves this Connection object's current schema name.

public SessionInterface

Returns:

the underlying sessionProxy for this connection
getSession
()

provides cross-package access to the proprietary (i.e. non-JDBC) HSQLDB session interface.

public synchronized int

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.
getTransactionIsolation
()

Implements java.sql.Connection.getTransactionIsolation.

Retrieves this Connection object's current transaction isolation level.

public synchronized Map<String, Class<?>>

Returns:

the java.util.Map object associated with this Connection object
getTypeMap
()

Implements java.sql.Connection.getTypeMap.

Retrieves the Map object associated with this Connection object.

public synchronized String

Returns:

the database connection url with which this object was constructed
getURL
()

Retrieves this connection's JDBC url.

public synchronized SQLWarning

Returns:

the first SQLWarning object or null if there are none
getWarnings
()

Implements java.sql.Connection.getWarnings.

Retrieves the first warning reported by calls on this Connection object.

public synchronized boolean

Returns:

true if this Connection object is closed; false if it is still open
isClosed
()

Implements java.sql.Connection.isClosed.

Retrieves whether this Connection object has been closed.

public boolean
public boolean
public synchronized boolean

Returns:

true if this Connection object is read-only; false otherwise
isReadOnly
()

Implements java.sql.Connection.isReadOnly.

Retrieves whether this Connection object is in read-only mode.

public boolean

Returns:

true if the connection is valid, false otherwise
isValid
(int
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.
timeout
)

Implements java.sql.Connection.isValid.

Returns true if the connection has not been closed and is still valid.

public boolean

Returns:

true if this implements the interface or directly or indirectly wraps an object that does.
isWrapperFor
(Class<?>
a Class defining an interface.
iface
)

Implements java.sql.Wrapper.isWrapperFor.

Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.

public synchronized String

Returns:

the native form of this statement
nativeSQL
(final String
an SQL statement that may contain one or more '?' parameter placeholders
sql
)

Implements java.sql.Connection.nativeSQL.

Converts the given SQL statement into the system's native SQL grammar.

private int
onStartEscapeSequence(String sql, StringBuilder sb, int i)

is called from within nativeSQL when the start of an JDBC escape sequence is encountered

public synchronized CallableStatement

Returns:

a new default CallableStatement object containing the pre-compiled SQL statement
prepareCall
(String
an SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is specified using JDBC call escape syntax.
sql
)

Implements java.sql.Connection.prepareCall.

Creates a CallableStatement object for calling database stored procedures.

public synchronized CallableStatement

Returns:

a new CallableStatement object containing the pre-compiled SQL statement that will produce ResultSet objects with the given type and concurrency
prepareCall
(String
a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
sql
,
int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Implements java.sql.Connection.prepareCall.

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.

public synchronized CallableStatement

Returns:

a new CallableStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
prepareCall
(String
a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
sql
,
int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Implements java.sql.Connection.prepareCall.

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.

public synchronized PreparedStatement

Returns:

a new default PreparedStatement object containing the pre-compiled SQL statement
prepareStatement
(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
)

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object for sending parameterized SQL statements to the database.

public synchronized PreparedStatement

Returns:

a new PreparedStatement object containing the pre-compiled SQL statement that will produce ResultSet objects with the given type and concurrency
prepareStatement
(String
a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
sql
,
int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.

public synchronized PreparedStatement

Returns:

a new PreparedStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
prepareStatement
(String
a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
sql
,
int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.

public synchronized PreparedStatement

Returns:

a new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys
prepareStatement
(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
int
a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
autoGeneratedKeys
)

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys.

public synchronized PreparedStatement

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
prepareStatement
(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
int[]
an array of column indexes indicating the columns that should be returned from the inserted row or rows
columnIndexes
)

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.

public synchronized PreparedStatement

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
prepareStatement
(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
String[]
an array of column names indicating the columns that should be returned from the inserted row or rows
columnNames
)

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.

public synchronized void
releaseSavepoint(Savepoint
the Savepoint object to be removed
savepoint
)

Implements java.sql.Connection.releaseSavepoint.

Removes the specified Savepoint and subsequent Savepoint objects from the current transaction.

public void
reset()

Resets the SQL session of this connection, so it can be used again.

public synchronized void
rollback()

Implements java.sql.Connection.rollback.

Undoes all changes made in the current transaction and releases any database locks currently held by this Connection object.

public synchronized void
rollback(Savepoint
the Savepoint object to roll back to
savepoint
)

Implements java.sql.Connection.rollback.

Undoes all changes made after the given Savepoint object was set.

public synchronized void
setAutoCommit(boolean
true to enable auto-commit mode; false to disable it
autoCommit
)

Implements java.sql.Connection.setAutoCommit.

Sets this connection's auto-commit mode to the given state.

public synchronized void
setCatalog(String
the name of a catalog (subspace in this Connection object's database) in which to work
catalog
)

Implements java.sql.Connection.setCatalog.

Sets the given catalog name in order to select a subspace of this Connection object's database in which to work.

public void
setClientInfo(String
The name of the client info property to set
name
,
String
The value to set the client info property to. If the value is null, the current value of the specified property is cleared.
value
)

Implements java.sql.Connection.setClientInfo.

Sets the value of the client info property specified by name to the value specified by value.

public void
setClientInfo(Properties
the list of client info properties to set
properties
)

Implements java.sql.Connection.setClientInfo.

Sets the value of the connection's client info properties.

public synchronized void
setHoldability(int
a ResultSet holdability constant; one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
holdability
)

Implements java.sql.Connection.setHoldability.

Changes the default holdability of ResultSet objects created using this Connection object to the given holdability.

private void
public void
setNetworkTimeout(Executor
The Executor implementation which will be used by setNetworkTimeout.
executor
,
int
The time in milliseconds to wait for the database operation to complete. If the JDBC driver does not support milliseconds, the JDBC driver will round the value up to the nearest second. If the timeout period expires before the operation completes, a SQLException will be thrown. A value of 0 indicates that there is no timeout for database operations.
milliseconds
)

Implements java.sql.Connection.setNetworkTimeout.

Sets the maximum period a Connection or objects created from the Connection will wait for the database to reply to any one request.

public synchronized void
setReadOnly(boolean
true enables read-only mode; false disables it
readOnly
)

Implements java.sql.Connection.setReadOnly.

Puts this connection in read-only mode as a hint to the driver to enable database optimizations.

public synchronized Savepoint

Returns:

the new Savepoint object
setSavepoint
()

Implements java.sql.Connection.setSavepoint.

Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.

public synchronized Savepoint

Returns:

the new Savepoint object
setSavepoint
(String
a String containing the name of the savepoint
name
)

Implements java.sql.Connection.setSavepoint.

Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.

public synchronized void
setSchema(String
the name of a schema in which to work
schema
)

Implements java.sql.Connection.setSchema.

Sets the given schema name to access.

public synchronized void
setTransactionIsolation(int
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.)
level
)

Implements java.sql.Connection.setTransactionIsolation.

Attempts to change the transaction isolation level for this Connection object to the one given.

public synchronized void
setTypeMap(Map<String, Class<?>>
the java.util.Map object to install as the replacement for this Connection object's default type map
map
)

Implements java.sql.Connection.setTypeMap.

Installs the given TypeMap object as the type map for this Connection object.

pack-priv void
setWarnings(SQLWarning w)

Sets the warning chain

public <
by which the return type is inferred from input parameter.
T
>
T

Returns:

an object that implements the interface. May be a proxy for the actual implementing object.
unwrap
(Class<T>
A Class defining an interface that the result must implement.
iface
)

Implements java.sql.Wrapper.unwrap.

Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait