Java Doc for jdbcConnection.java in  » Database-DBMS » hsql » org » hsqldb » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » hsql » org.hsqldb.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.hsqldb.jdbc.jdbcConnection

jdbcConnection
public class jdbcConnection implements Connection(Code)
A connection (session) with a specific database. Within the context of a Connection, SQL statements are executed and results are returned.

A Connection'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: By default the Connection automatically commits changes after executing each statement. If auto commit has been disabled, an explicit commit must be done or database changes will not be saved.


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 1.7.2 Server Server database connection <url> has changed to take 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 1.7.2 WebServer WebServer database connection <url> also changes to take 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.

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


Transient, In-Process Database Connections:

The 1.7.2 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)

With the 1.7.2 transient, in-process database connection <url>, the <alias> component is the key used to look up a transient, in-process 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.


Persistent, In-Process Database Connections:

The 1.7.2 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.

As of 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 are:

  • <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 path of the working directory fixed at the time the JVM is started.

Under Windows TM , '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: Versions of HSQLDB previous to 1.7.0 did not support creating 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. Starting with HSQLDB 1.7.0, directories will be created if they do not already exist., but only if HSQLDB is built under a version of the compiler greater than JDK 1.1.x.

res: Connections

The new '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: type database connection <url> is used to obtain resource URL objects and thereby read the database files as resources on the class path. Moreover, the URL objects must point only to resources contained in one or more jars on the class path (must be jar protocol).

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 knowlege 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 WebStartTM and Java AppletTMconfigurations, 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 under 'files_in_jar' semantics, the <path> component of the res: database connection <url> is always taken to be relative to the default package. That is, if the <path> component does not start with '/', then '/' is prepended when obtaining the resource URLs used to read the database files.


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 Advanced Users Guide.


JRE 1.1.x Notes:

In general, JDBC 2 support requires Java 1.2 and above, and JDBC3 requires Java 1.4 and above. In HSQLDB, support for methods introduced in different versions of JDBC depends on the JDK version used for compiling and building HSQLDB.

Since 1.7.0, it is possible to build the product so that all JDBC 2 methods can be called while executing under the version 1.1.x Java Runtime EnvironmentTM. However, in addition to this technique requiring explicit casts to the org.hsqldb.jdbcXXX classes, some of the method calls also require int values that are defined only in the JDBC 2 or greater version of ResultSet interface. For this reason, when the product is compiled under JDK 1.1.x, these values are defined in org.hsqldb.jdbc.jdbcResultSet jdbcResultSet .

In a JRE 1.1.x environment, calling JDBC 2 methods that take or return the JDBC2-only ResultSet values can be achieved by referring to them in parameter specifications and return value comparisons, respectively, as follows:

 jdbcResultSet.FETCH_FORWARD
 jdbcResultSet.TYPE_FORWARD_ONLY
 jdbcResultSet.TYPE_SCROLL_INSENSITIVE
 jdbcResultSet.CONCUR_READ_ONLY
 // etc.
 
However, please note that code written to use HSQLDB JDBC 2 features under JDK 1.1.x will not be compatible for use with other JDBC 2 drivers. Please also note that this feature is offered solely as a convenience to developers who must work under JDK 1.1.x due to operating constraints, yet wish to use some of the more advanced features available under the JDBC 2 specification.


(fredt@users)
(boucherb@users)


author:
   boucherb@users
author:
   fredt@users
version:
   1.7.2
See Also:   org.hsqldb.jdbcDriver
See Also:   jdbcStatement
See Also:   jdbcPreparedStatement
See Also:   jdbcCallableStatement
See Also:   jdbcResultSet
See Also:   jdbcDatabaseMetaData


Field Summary
 HsqlPropertiesconnProperties
    
 booleanisClosed
    
 booleanisInternal
    
protected  booleanisNetConn
     Is this connection to a network server instance.
 SessionInterfacesessionProxy
     This connection's interface to the corresponding Session object in the database engine.

Constructor Summary
public  jdbcConnection(HsqlProperties props)
     Constructs a new external Connection to an HSQLDB Database.
public  jdbcConnection(Session c)
     Constructs an INTERNAL Connection, using the specified Session Session .

Method Summary
 voidaddWarning(SQLWarning w)
     Adds another SQLWarning to this Connection object's warning chain.
synchronized  voidcheckClosed()
     An internal check for closed connections.
public synchronized  voidclearWarnings()
     Clears all warnings reported for this Connection object.
 voidclearWarningsNoCheck()
     Clears the warning chain without checking if this Connection is closed.
public synchronized  voidclose()
     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.

public synchronized  voidcommit()
     Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.
public synchronized  StatementcreateStatement()
     Creates a Statement object for sending SQL statements to the database.
public synchronized  StatementcreateStatement(int type, int concurrency)
     Creates a Statement object that will generate ResultSet objects with the given type and concurrency.
public synchronized  StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.
protected  voidfinalize()
    
public synchronized  booleangetAutoCommit()
     Gets the current auto-commit state.
public synchronized  StringgetCatalog()
     Returns the Connection's current catalog name.
public synchronized  intgetHoldability()
     Retrieves the current holdability of ResultSet objects created using this Connection object.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, this feature is supported.

public synchronized  DatabaseMetaDatagetMetaData()
     Gets the metadata regarding this connection's database. A Connection'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.
public synchronized  intgetTransactionIsolation()
     Retrieves this Connection object's current transaction isolation level.
public synchronized  MapgetTypeMap()
     Gets the type map object associated with this connection.
synchronized  StringgetURL()
     Retrieves this connection's JDBC url.
public synchronized  SQLWarninggetWarnings()
     Retrieves the first warning reported by calls on this Connection object.
public synchronized  booleanisClosed()
     Tests to see if a Connection is closed.
public synchronized  booleanisReadOnly()
     Tests to see if the connection is in read-only mode.
public synchronized  StringnativeSQL(String sql)
     Converts the given SQL statement into the system's native SQL grammar.
public synchronized  CallableStatementprepareCall(String sql)
     Creates a CallableStatement object for calling database stored procedures.
public synchronized  CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)
     Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
public synchronized  CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
public synchronized  PreparedStatementprepareStatement(String sql)
     Creates a PreparedStatement object for sending parameterized SQL statements to the database.
public synchronized  PreparedStatementprepareStatement(String sql, int type, int concurrency)
     Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.
public synchronized  PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.
public synchronized  PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)
     Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys.
public synchronized  PreparedStatementprepareStatement(String sql, int[] columnIndexes)
     Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
public synchronized  PreparedStatementprepareStatement(String sql, String[] columnNames)
     Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
public synchronized  voidreleaseSavepoint(Savepoint savepoint)
     Removes the given Savepoint object from the current transaction.
public  voidreset()
     Resets this connection so it can be used again.
public synchronized  voidrollback()
     Drops all changes made since the previous commit/rollback and releases any database locks currently held by this Connection.
public synchronized  voidrollback(Savepoint savepoint)
     Undoes all changes made after the given Savepoint object was set.
public synchronized  voidsetAutoCommit(boolean autoCommit)
     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.
public synchronized  voidsetCatalog(String catalog)
     Sets a catalog name in order to select a subspace of this Connection's database in which to work.
public synchronized  voidsetHoldability(int holdability)
     Changes the holdability of ResultSet objects created using this Connection object to the given holdability.
public synchronized  voidsetReadOnly(boolean readonly)
     Puts this connection in read-only mode as a hint to enable database optimizations.
public synchronized  SavepointsetSavepoint()
     Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature.

public synchronized  SavepointsetSavepoint(String name)
     Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.
public synchronized  voidsetTransactionIsolation(int level)
     Attempts to change the transaction isolation level for this Connection object to the one given.
public synchronized  voidsetTypeMap(Map map)
     Installs the given TypeMap object as the type map for this Connection object.
 intxlateRSConcurrency(int concurrency)
     Translates ResultSet concurrency, adding to the warning chain if the requested concurrency is downgraded.
 intxlateRSHoldability(int holdability)
     Translates ResultSet holdability, adding to the warning chain if the requested holdability is changed from an unsupported to a supported value.
 intxlateRSType(int type)
     Translates ResultSet type, adding to the warning chain if the requested type is downgraded.

Field Detail
connProperties
HsqlProperties connProperties(Code)
Properties for the connection



isClosed
boolean isClosed(Code)
Is this connection closed?



isInternal
boolean isInternal(Code)
Is this an internal connection?



isNetConn
protected boolean isNetConn(Code)
Is this connection to a network server instance.



sessionProxy
SessionInterface sessionProxy(Code)
This connection's interface to the corresponding Session object in the database engine.




Constructor Detail
jdbcConnection
public jdbcConnection(HsqlProperties props) throws SQLException(Code)
Constructs a new external Connection to an HSQLDB Database.

This constructor is called on behalf of the java.sql.DriverManager when getting a Connection for use in normal (external) client code.

Internal client code, that being code located in HSQLDB SQL functions and stored procedures, receives an INTERNAL connection constructed by the jdbcConnection.jdbcConnection(Session)jdbcConnection(Session) constructor.


Parameters:
  props - A Properties object containing the connectionproperties
exception:
  SQLException - when the user/password combination isinvalid, the connection url is invalid, or theDatabase is unavailable.

The Database may be unavailable for a numberof reasons, including network problems or the fact that itmay already be in use by another process.




jdbcConnection
public jdbcConnection(Session c) throws HsqlException(Code)
Constructs an INTERNAL Connection, using the specified Session Session .

This constructor is called only on behalf of an existing Session (the internal parallel of a Connection), to be used as a parameter to a SQL function or stored procedure that needs to execute in the context of that Session.

When a Java SQL function or stored procedure is called and its first parameter is of type Connection, HSQLDB automatically notices this and constructs an INTERNAL Connection using the current Session. HSQLDB then passes this Connection in the first parameter position, moving any other parameter values specified in the SQL statement to the right by one position.

To read more about this, see Function.getValue .

Notes:

Starting with HSQLDB 1.7.2, INTERNAL connections are not closed by a call to close() or by a SQL DISCONNECT. For HSQLDB developers not involved with writing database internals, this change only applies to connections obtained automatically from the database as the first parameter to stored procedures and SQL functions. This is mainly an issue to developers writing custom SQL function and stored procedure libraries for HSQLDB. Presently, it is recommended that SQL function and stored procedure code avoid depending on closing or issuing a DISCONNECT on a connection obtained in this manner.


Parameters:
  c - the Session requesting the construction of thisConnection
exception:
  HsqlException - never (reserved for future use);
See Also:   org.hsqldb.Function





Method Detail
addWarning
void addWarning(SQLWarning w)(Code)
Adds another SQLWarning to this Connection object's warning chain.
Parameters:
  w - the SQLWarning to add to the chain



checkClosed
synchronized void checkClosed() throws SQLException(Code)
An internal check for closed connections.


throws:
  SQLException - when the connection is closed




clearWarnings
public synchronized void clearWarnings() throws SQLException(Code)
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.

HSQLDB-Specific Information:

Before HSQLDB 1.7.2, SQLWarning was not supported, and calls to this method are simply ignored.

Starting with HSQLDB 1.7.2, the standard behaviour is implemented.


exception:
  SQLException - if a database access error occurs




clearWarningsNoCheck
void clearWarningsNoCheck()(Code)
Clears the warning chain without checking if this Connection is closed.



close
public synchronized void close() throws SQLException(Code)
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.

HSQLDB-Specific Information:

In 1.7.2, INTERNAL Connection objects are not closable from JDBC client code.


exception:
  SQLException - if a database access error occurs



commit
public synchronized void commit() throws SQLException(Code)
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should be used only when auto-commit mode has been disabled.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, savepoints are supported both in SQL and via the JDBC interface.

Using SQL, savepoints may be set, released and used in rollback as follows:

 SAVEPOINT <savepoint-name>
 RELEASE SAVEPOINT <savepoint-name>
 ROLLBACK TO SAVEPOINT <savepoint-name>
 

exception:
  SQLException - if a database access error occurs
See Also:   jdbcConnection.setAutoCommit



createStatement
public synchronized Statement createStatement() throws SQLException(Code)
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.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, support for precompilation at the engine level has been implemented, so it is now much more efficient and performant to use a PreparedStatement object if the same SQL statement is executed many times.

Up to 1.6.1, HSQLDB supported TYPE_FORWARD_ONLY - CONCUR_READ_ONLY results only, so ResultSet objects created using the returned Statement object would always be type TYPE_FORWARD_ONLY with CONCUR_READ_ONLY concurrency.

Starting with 1.7.0, HSQLDB also supports TYPE_SCROLL_INSENSITIVE results.

Notes:

Up to 1.6.1, calling this method returned null if the connection was already closed. This was possibly counter-intuitive to the expectation that an exception would be thrown for closed connections. Starting with 1.7.0. the behaviour is to throw a SQLException if the connection is closed.

a new default Statement object
throws:
  SQLException - if a database access error occurs


See Also:   jdbcConnection.createStatement(int,int)
See Also:   jdbcConnection.createStatement(int,int,int)




createStatement
public synchronized Statement createStatement(int type, int concurrency) throws SQLException(Code)
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 result set concurrency type to be overridden.

HSQLDB-Specific Information:

Up to HSQLDB 1.6.1, support was provided only for type TYPE_FORWARD_ONLY and concurrency CONCUR_READ_ONLY.

Starting with HSQLDB 1.7.0, support is now provided for types TYPE_FORWARD_ONLY, and TYPE_SCROLL_INSENSITIVE, with concurrency CONCUR_READ_ONLY. Starting with HSQLDB 1.7.2, the behaviour regarding the type and concurrency values has changed to more closely conform to the specification. That is, if an unsupported combination is requested, a SQLWarning is issued on this Connection and the closest supported combination is used instead.

Notes:

Up to 1.6.1, calling this method returned null if the connection was already closed and a supported combination of type and concurrency was specified. This was possibly counter-intuitive to the expectation that an exception would be thrown for closed connections. Starting with 1.7.0. the behaviour is to throw a SQLException if the connection is closed.


Parameters:
  type - a result set type; one ofResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVE (notsupported)
Parameters:
  concurrency - a concurrency type; one ofResultSet.CONCUR_READ_ONLYor ResultSet.CONCUR_UPDATABLE (not supported) a new Statement object that will, withinthe release-specific documented limitations of support,generate ResultSet objects with the giventype and concurrency
exception:
  SQLException - if a database access error occurs orthe given parameters are not ResultSet constantsindicating a supported type and concurrency
since:
   JDK 1.2 (JDK 1.1.x developers: read the new overview
since:
   for jdbcConnection)



createStatement
public synchronized Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
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.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, this feature is supported.

Starting with HSQLDB 1.7.2, the behaviour regarding the type, concurrency and holdability values has changed to more closely conform to the specification. That is, if an unsupported combination is requested, a SQLWarning is issued on this Connection and the closest supported combination is used instead.


Parameters:
  resultSetType - one of the following ResultSetconstants: ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE,or ResultSet.TYPE_SCROLL_SENSITIVE
Parameters:
  resultSetConcurrency - one of the followingResultSetconstants: ResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE
Parameters:
  resultSetHoldability - one of the followingcode>ResultSetconstants: ResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT a new Statement object that will generateResultSet objects with the given type,concurrency, and holdability
exception:
  SQLException - if a database access error occurs orthe given parameters are not ResultSetconstants indicating type, concurrency, and holdability
See Also:   ResultSet
since:
   JDK 1.4, HSQLDB 1.7.2



finalize
protected void finalize()(Code)
The default implementation simply attempts to silently jdbcConnection.close() close() this Connection



getAutoCommit
public synchronized boolean getAutoCommit() throws SQLException(Code)
Gets the current auto-commit state. the current state of auto-commit mode
exception:
  SQLException - Description of the Exception
See Also:   jdbcConnection.setAutoCommit



getCatalog
public synchronized String getCatalog() throws SQLException(Code)
Returns the Connection's current catalog name.

HSQLDB-Specific Information:

HSQLDB does not yet support catalogs and always returns null.

the current catalog name or null

For HSQLDB, this is always null.
exception:
  SQLException - Description of the Exception




getHoldability
public synchronized int getHoldability() throws SQLException(Code)
Retrieves the current holdability of ResultSet objects created using this Connection object.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, this feature is supported.

Calling this method always returns HOLD_CURSORS_OVER_COMMIT.

the holdability, one ofResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT
throws:
  SQLException - if a database access occurs
See Also:   jdbcConnection.setHoldability
See Also:   ResultSet
since:
   JDK 1.4, HSQLDB 1.7.2



getMetaData
public synchronized DatabaseMetaData getMetaData() throws SQLException(Code)
Gets the metadata regarding this connection's database. A Connection'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 made available through a DatabaseMetaData object.

HSQLDB-Specific Information:

JDBC DatabaseMetaData methods returning ResultSet were not implemented fully before 1.7.2. Some of these methods always returned empty result sets. Other methods did not accurately reflect all of the MetaData for the category. Also, some method ignored the filters provided as parameters, returning an unfiltered result each time.

Also, the majority of methods returning ResultSet threw an SQLException when accessed by a non-admin user.


Starting with HSQLDB 1.7.2, essentially full database metadata is supported.

For discussion in greater detail, please follow the link to the overview for jdbcDatabaseMetaData, below.

a DatabaseMetaData object for this Connection
throws:
  SQLException - if a database access error occurs
See Also:   jdbcDatabaseMetaData



getTransactionIsolation
public synchronized int getTransactionIsolation() throws SQLException(Code)
Retrieves this Connection object's current transaction isolation level.

HSQLDB-Specific Information:

HSQLDB always returns Connection.TRANSACTION_READ_UNCOMMITED.

the current transaction isolation level, which will beone of the following constants:Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED,Connection.TRANSACTION_REPEATABLE_READ,Connection.TRANSACTION_SERIALIZABLE, orConnection.TRANSACTION_NONE

Up to and including 1.7.1, TRANSACTION_READ_UNCOMMITTED isalways returned
exception:
  SQLException - if a database access error occurs


See Also:   jdbcDatabaseMetaData.supportsTransactionIsolationLevel
See Also:   jdbcConnection.setTransactionIsolation
See Also:    setTransactionIsolation




getTypeMap
public synchronized Map getTypeMap() throws SQLException(Code)
Gets the type map object associated with this connection. Unless the application has added an entry to the type map, the map returned will be empty.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature. Calling this method always throws a SQLException, stating that the function is not supported.

the java.util.Map object associated withthis Connection object
exception:
  SQLException - if a database access error occurs(always, up to HSQLDB 1.7.0, inclusive)
since:
   JDK 1.2 (JDK 1.1.x developers: read the new overview
since:
   for jdbcConnection)



getURL
synchronized String getURL() throws SQLException(Code)
Retrieves this connection's JDBC url. This method is in support of the jdbcDatabaseMetaData.getURL() method. the database connection url with which this object wasconstructed



getWarnings
public synchronized SQLWarning getWarnings() throws SQLException(Code)
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.

HSQLDB-Specific Information:

Starting with 1.7.2, HSQLDB produces warnings whenever a createStatement(), prepareStatement() or prepareCall() invocation requests an unsupported but defined combination of result set type, concurrency and holdability, such that another set is substituted.

the first SQLWarning object or nullif there are none


exception:
  SQLException - if a database access error occurs orthis method is called on a closed connection


See Also:   SQLWarning




isClosed
public synchronized boolean isClosed()(Code)
Tests to see if a Connection is closed. true if the connection is closed; false if it's stillopen



isReadOnly
public synchronized boolean isReadOnly() throws SQLException(Code)
Tests to see if the connection is in read-only mode. true if connection is read-only and false otherwise
exception:
  SQLException - if a database access error occurs



nativeSQL
public synchronized String nativeSQL(String sql) throws SQLException(Code)
Converts the given SQL statement into the system's native SQL grammar. A driver may convert the JDBC SQL grammar into its system's native SQL grammar prior to sending it. This method returns the native form of the statement that the driver would have sent.

HSQLDB-Specific Information:

Up to and including 1.7.2, HSQLDB converts the JDBC SQL grammar into the system's native SQL grammar prior to sending it, if escape processing is set true; this method returns the native form of the statement that the driver would send in place of client-specified JDBC SQL grammar.

Before 1.7.2, escape processing was incomplete and also broken in terms of support for nested escapes.

Starting with 1.7.2, escape processing is complete and handles nesting to arbitrary depth, but enforces a very strict interpretation of the syntax and does not detect or process SQL comments.

In essence, the HSQLDB engine directly handles the prescribed syntax and date / time formats specified internal to the JDBC escapes. It also directly offers the XOpen / ODBC extended scalar functions specified available internal to the {fn ...} JDBC escape. As such, the driver simply removes the curly braces and JDBC escape codes in the simplest and fastest fashion possible, by replacing them with whitespace. But to avoid a great deal of complexity, certain forms of input whitespace are currently not recognised. For instance, the driver handles "{?= call ...}" but not "{ ?= call ...} or "{? = call ...}"

Also, comments embedded in SQL are currently not detected or processed and thus may have unexpected effects on the output of this method, for instance causing otherwise valid SQL to become invalid. It is especially important to be aware of this because escape processing is set true by default for Statement objects and is always set true when producing a PreparedStatement from prepareStatement() or CallableStatement from prepareCall(). Currently, it is simply recommended to avoid submitting SQL having comments containing JDBC escape sequence patterns and/or single or double quotation marks, as this will avoid any potential problems. It is intended to implement a less strict handling of whitespace and proper processing of SQL comments at some point in the near future, perhaps before the final 1.7.2 release. In any event, 1.7.2 now correctly processes the following JDBC escape forms to arbitrary nesting depth, but only if the exact whitespace layout described below is used:

  1. {call ...}
  2. {?= call ...}
  3. {fn ...}
  4. {oj ...}
  5. {d ...}
  6. {t ...}
  7. {ts ...}


Parameters:
  sql - a SQL statement that may contain one or more '?'parameter placeholders the native form of this statement
throws:
  SQLException - if a database access error occurs




prepareCall
public synchronized CallableStatement prepareCall(String sql) throws SQLException(Code)
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.

HSQLDB-Specific Information:

Starting with 1.7.2, the support for and behaviour of CallableStatement has changed. Please read the introductory section of the documentation for org.hsqldb.jdbc.jdbcCallableStatement.


Parameters:
  sql - a String object that is the SQL statement to besent to the database; may contain one or more ?parameters.

Note: Typically the SQL statement is a JDBCfunction call escape string. a new default CallableStatement objectcontaining the pre-compiled SQL statement
exception:
  SQLException - if a database access error occurs


See Also:   jdbcConnection.prepareCall(String,int,int)




prepareCall
public synchronized CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code)
Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareCall method above, but it allows the default result set type and result set concurrency type to be overridden.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, the behaviour regarding the type, concurrency and holdability values has changed to more closely conform to the specification. That is, if an unsupported combination is requrested, a SQLWarning is issued on this Connection and the closest supported combination is used instead.

Also starting with 1.7.2, the support for and behaviour of CallableStatement has changed. Please read the introdutory section of the documentation for org.hsqldb.jdbc.jdbcCallableStatement.


Parameters:
  sql - a String object that is the SQL statement to besent to the database; may contain one or more ? parameters
Parameters:
  resultSetType - a result set type; one ofResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, (notsupported) or ResultSet.TYPE_SCROLL_SENSITIVE(not supported)
Parameters:
  resultSetConcurrency - a concurrency type; one ofResultSet.CONCUR_READ_ONLYor ResultSet.CONCUR_UPDATABLE (not supported) a new CallableStatement object containing thepre-compiled SQL statement
exception:
  SQLException - if a database access error occurs orthe given parameters are not ResultSetconstants indicating a supported type and concurrency
since:
   JDK 1.2 (JDK 1.1.x developers: read the new overview
since:
   for jdbcConnection)



prepareCall
public synchronized CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareCall method above, but it allows the default result set type, result set concurrency type and holdability to be overridden.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, this feature is supported.

Starting with HSQLDB 1.7.2, the behaviour regarding the type, concurrency and holdability values has changed to more closely conform to the specification. That is, if an unsupported combination is requrested, a SQLWarning is issued on this Connection and the closest supported combination is used instead.

Also starting with 1.7.2, the support for and behaviour of CallableStatment has changed. Please read the introdutory section of the documentation for org.hsqldb.jdbc.jdbcCallableStatement.


Parameters:
  sql - a String object that is the SQLstatement to be sent to the database; may contain on ormore ? parameters
Parameters:
  resultSetType - one of the following ResultSetconstants: ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVE
Parameters:
  resultSetConcurrency - one of the followingResultSetconstants: ResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE
Parameters:
  resultSetHoldability - one of the followingResultSetconstants: ResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT a new CallableStatement object,containing the pre-compiled SQL statement, that willgenerate ResultSet objects with the giventype, concurrency, and holdability
exception:
  SQLException - if a database access error occurs orthe given parameters are not ResultSetconstants indicating type, concurrency, and holdability
See Also:   ResultSet
since:
   JDK 1.4, HSQLDB 1.7.2



prepareStatement
public synchronized PreparedStatement prepareStatement(String sql) throws SQLException(Code)
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.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, support for precompilation at the engine level has been implemented, so it is now much more efficient and performant to use a PreparedStatement object if the same SQL statement is executed many times.

Starting with 1.7.2, the support for and behaviour of PreparedStatment has changed. Please read the introductory section of the documentation for org.hsqldb.jdbc.jdbcPreparedStatement.


Parameters:
  sql - an SQL statement that may contain one or more '?'IN parameter placeholders a new default PreparedStatement objectcontaining the pre-compiled SQL statement
exception:
  SQLException - if a database access error occurs


See Also:   jdbcConnection.prepareStatement(String,int,int)




prepareStatement
public synchronized PreparedStatement prepareStatement(String sql, int type, int concurrency) throws SQLException(Code)
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 result set concurrency type to be overridden.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, the behaviour regarding the type and concurrency values has changed to more closely conform to the specification. That is, if an unsupported combination is requested, a SQLWarning is issued on this Connection and the closest supported combination is used instead.

Also starting with 1.7.2, the support for and behaviour of PreparedStatment has changed. Please read the introductory section of the documentation for org.hsqldb.jdbc.jdbcPreparedStatement.


Parameters:
  sql - a String object that is the SQL statement to besent to the database; may contain one or more ? INparameters
Parameters:
  type - a result set type; one ofResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE, orResultSet.TYPE_SCROLL_SENSITIVE (notsupported)
Parameters:
  concurrency - a concurrency type; one ofResultSet.CONCUR_READ_ONLYor ResultSet.CONCUR_UPDATABLE (not supported) a new PreparedStatement object containing thepre-compiled SQL statement that will produceResultSetobjects with the given type and concurrency
exception:
  SQLException - if a database access error occurs orthe given parameters are not ResultSet constantsindicating a supported type and concurrency
since:
   JDK 1.2 (JDK 1.1.x developers: read the new overview
since:
   for jdbcConnection)



prepareStatement
public synchronized PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code)
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.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, this feature is supported.

Starting with HSQLDB 1.7.2, the behaviour regarding the type, concurrency and holdability values has changed to more closely conform to the specification. That is, if an unsupported combination is requested, a SQLWarning is issued on this Connection and the closest supported combination is used instead.

Also starting with 1.7.2, the support for and behaviour of PreparedStatment has changed. Please read the introductory section of the documentation for org.hsqldb.jdbc.jdbcPreparedStatement.


Parameters:
  sql - a String object that is the SQLstatement to be sent to the database; may contain one ormore ? IN parameters
Parameters:
  resultSetType - one of the following ResultSetconstants: ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE,or ResultSet.TYPE_SCROLL_SENSITIVE
Parameters:
  resultSetConcurrency - one of the followingResultSetconstants: ResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE
Parameters:
  resultSetHoldability - one of the followingResultSetconstants: ResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT a new PreparedStatement object,containing the pre-compiled SQL statement, that willgenerate ResultSet objects with the giventype, concurrency, and holdability
exception:
  SQLException - if a database access error occurs orthe given parameters are not ResultSetconstants indicating type, concurrency, and holdability
See Also:   ResultSet
since:
   JDK 1.4, HSQLDB 1.7.2



prepareStatement
public synchronized PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException(Code)
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.

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.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature.

Calling this method always throws a SQLException, stating that the function is not supported.


Parameters:
  sql - an SQL statement that may contain one or more '?'IN parameter placeholders
Parameters:
  autoGeneratedKeys - a flag indicating that auto-generatedkeys should be returned, one ofcode>Statement.RETURN_GENERATED_KEYSor Statement.NO_GENERATED_KEYS. a new PreparedStatement object,containing the pre-compiled SQL statement, that will havethe capability of returning auto-generated keys
exception:
  SQLException - if a database access error occurs orthe given parameter is not a Statementconstant indicating whether auto-generated keys should bereturned
since:
   JDK 1.4, HSQLDB 1.7.2



prepareStatement
public synchronized PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException(Code)
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.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature.

Calling this method always throws a SQLException, stating that the function is not supported.


Parameters:
  sql - an SQL statement that may contain one or more '?'IN parameter placeholders
Parameters:
  columnIndexes - an array of column indexes indicating thecolumns that should be returned from the inserted row orrows a new PreparedStatement object,containing the pre-compiled statement, that is capable ofreturning the auto-generated keys designated by the givenarray of column indexes
exception:
  SQLException - if a database access error occurs
since:
   JDK 1.4, HSQLDB 1.7.2



prepareStatement
public synchronized PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException(Code)
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.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature.

Calling this method always throws a SQLException, stating that the function is not supported.


Parameters:
  sql - an SQL statement that may contain one or more '?'IN parameter placeholders
Parameters:
  columnNames - an array of column names indicating thecolumns that should be returned from the inserted row orrows a new PreparedStatement object,containing the pre-compiled statement, that is capable ofreturning the auto-generated keys designated by the givenarray of column names
exception:
  SQLException - if a database access error occurs
since:
   JDK 1.4, HSQLDB 1.7.2



releaseSavepoint
public synchronized void releaseSavepoint(Savepoint savepoint) throws SQLException(Code)
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.


Parameters:
  savepoint - the Savepoint object to be removed
exception:
  SQLException - if a database access error occurs orthe given Savepoint object is not a validsavepoint in the current transaction
See Also:   jdbcSavepoint
See Also:   java.sql.Savepoint
since:
   JDK 1.4, HSQLDB 1.7.2




reset
public void reset() throws SQLException(Code)
Resets this connection so it can be used again. Used when connections are returned to a connection pool.



rollback
public synchronized void rollback() throws SQLException(Code)
Drops all changes made since the previous commit/rollback and releases any database locks currently held by this Connection. This method should be used only when auto- commit has been disabled.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, savepoints are fully supported both in SQL and via the JDBC interface.

Using SQL, savepoints may be set, released and used in rollback as follows:

 SAVEPOINT <savepoint-name>
 RELEASE SAVEPOINT <savepoint-name>
 ROLLBACK TO SAVEPOINT <savepoint-name>
 

exception:
  SQLException - if a database access error occurs
See Also:   jdbcConnection.setAutoCommit



rollback
public synchronized void rollback(Savepoint savepoint) throws SQLException(Code)
Undoes all changes made after the given Savepoint object was set.

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


Parameters:
  savepoint - the Savepoint object to roll back to
exception:
  SQLException - if a database access error occurs,the Savepoint object is no longer valid,or this Connection object is currently inauto-commit mode
See Also:   jdbcSavepoint
See Also:   java.sql.Savepoint
See Also:   jdbcConnection.rollback
since:
   JDK 1.4, HSQLDB 1.7.2




setAutoCommit
public synchronized void setAutoCommit(boolean autoCommit) throws SQLException(Code)
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.

HSQLDB-Specific Information:

Up to and including HSQLDB 1.7.2,

  1. All rows of a result set are retrieved internally before the first row can actually be fetched.
    Therefore, a statement can be considered complete as soon as any XXXStatement.executeXXX method returns.
  2. Multiple result sets and output parameters are not yet supported.

(boucherb@users)


Parameters:
  autoCommit - true to enable auto-commitmode; false to disable it
exception:
  SQLException - if a database access error occurs
See Also:   jdbcConnection.getAutoCommit



setCatalog
public synchronized void setCatalog(String catalog) throws SQLException(Code)
Sets a catalog name in order to select a subspace of this Connection's database in which to work.

HSQLDB-Specific Information:

HSQLDB does not yet support catalogs and simply ignores this request.


Parameters:
  catalog - the name of a catalog (subspace in thisConnection object's database) in which to work (Ignored)
throws:
  SQLException - if a database access error occurs




setHoldability
public synchronized void setHoldability(int holdability) throws SQLException(Code)
Changes the holdability of ResultSet objects created using this Connection object to the given holdability.

HSQLDB-Specific Information:

Starting with HSQLDB 1.7.2, this feature is supported.

As of 1.7.2, only HOLD_CURSORS_OVER_COMMIT is supported; supplying any other value will throw an exception.


Parameters:
  holdability - a ResultSet holdabilityconstant; one of ResultSet.HOLD_CURSORS_OVER_COMMITor ResultSet.CLOSE_CURSORS_AT_COMMIT
throws:
  SQLException - if a database access occurs, the givenparameter is not a ResultSet constantindicating holdability, or the given holdability is notsupported
See Also:   jdbcConnection.getHoldability
See Also:   ResultSet
since:
   JDK 1.4, HSQLDB 1.7.2



setReadOnly
public synchronized void setReadOnly(boolean readonly) throws SQLException(Code)
Puts this connection in read-only mode as a hint to enable database optimizations.

Note: This method should not be called while in the middle of a transaction.

HSQLDB-Specific Information:

Up to and including 1.7.2, HSQLDB will commit the current transaction automatically when this method is called.

Additionally, HSQLDB provides a way to put a whole database in read-only mode. This is done by manually adding the line 'readonly=true' to the database's .properties file while the database is offline. Upon restart, all connections will be readonly, since the entire database will be readonly. To take a database out of readonly mode, simply take the database offline and remove the line 'readonly=true' from the database's .properties file. Upon restart, the database will be in regular (read-write) mode.

When a database is put in readonly mode, its files are opened in readonly mode, making it possible to create CD-based readonly databases. To create a CD-based readonly database that has CACHED tables and whose .data file is suspected of being highly fragmented, it is recommended that the database first be SHUTDOWN COMPACTed before copying the database files to CD. This will reduce the space required and may improve access times against the .data file which holds the CACHED table data.

Starting with 1.7.2, an alternate approach to opimizing the .data file before creating a CD-based readonly database is to issue the CHECKPOINT DEFRAG command followed by SHUTDOWN to take the database offline in preparation to burn the database files to CD.


Parameters:
  readonly - The new readOnly value
exception:
  SQLException - if a database access error occurs



setSavepoint
public synchronized Savepoint setSavepoint() throws SQLException(Code)
Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature.

Calling this method always throws a SQLException, stating that the function is not supported.

Use setSavepoint(String name) instead

the new Savepoint object
exception:
  SQLException - if a database access error occurs orthis Connection object is currently inauto-commit mode
See Also:   jdbcSavepoint
See Also:   java.sql.Savepoint
since:
   JDK 1.4, HSQLDB 1.7.2



setSavepoint
public synchronized Savepoint setSavepoint(String name) throws SQLException(Code)
Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.


Parameters:
  name - a String containing the name of the savepoint the new Savepoint object
exception:
  SQLException - if a database access error occurs orthis Connection object is currently inauto-commit mode
See Also:   jdbcSavepoint
See Also:   java.sql.Savepoint
since:
   JDK 1.4, HSQLDB 1.7.2




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


Parameters:
  level - one of the following Connectionconstants: Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED,Connection.TRANSACTION_REPEATABLE_READ, orConnection.TRANSACTION_SERIALIZABLE. (Notethat Connection.TRANSACTION_NONE cannot beused because it specifies that transactions are notsupported.)
exception:
  SQLException - if a database access error occurs orthe given parameter is not one of the Connectionconstants


See Also:   jdbcDatabaseMetaData.supportsTransactionIsolationLevel
See Also:   jdbcConnection.getTransactionIsolation




setTypeMap
public synchronized void setTypeMap(Map map) throws SQLException(Code)
Installs the given TypeMap object as the type map for this Connection object. The type map will be used for the custom mapping of SQL structured types and distinct types.

HSQLDB-Specific Information:

HSQLDB 1.7.2 does not support this feature. Calling this method always throws a SQLException, stating that the function is not supported.


Parameters:
  map - the java.util.Map object to install asthe replacement for this Connection object'sdefault type map
exception:
  SQLException - if a database access error occurs orthe given parameter is not a java.util.Mapobject (always, up to HSQLDB 1.7.0, inclusive)
since:
   JDK 1.2 (JDK 1.1.x developers: read the new overview
since:
   for jdbcConnection)
See Also:   jdbcConnection.getTypeMap



xlateRSConcurrency
int xlateRSConcurrency(int concurrency) throws SQLException(Code)
Translates ResultSet concurrency, adding to the warning chain if the requested concurrency is downgraded.

Starting with HSQLDB 1.7.2, CONCUR_READ_ONLY is passed through while CONCUR_UPDATABLE is downgraded to CONCUR_READ_ONLY and an SQLWarning is issued.
Parameters:
  concurrency - of ResultSet; one ofjdbcResultSet.CONCUR_XXX the actual concurrency that will be used
throws:
  SQLException - if concurrency is not one of the defined values




xlateRSHoldability
int xlateRSHoldability(int holdability) throws SQLException(Code)
Translates ResultSet holdability, adding to the warning chain if the requested holdability is changed from an unsupported to a supported value.

Starting with HSQLDB 1.7.2, HOLD_CURSORS_OVER_COMMIT is passed through while CLOSE_CURSORS_AT_COMMIT is changed to HOLD_CURSORS_OVER_COMMIT and an SQLWarning is issued.


Parameters:
  holdability - of ResultSet; one ofjdbcResultSet.HOLD_CURSORS_OVER_COMMIT orjdbcResultSet.CLOSE_CURSORS_AT_COMMIT the actual holdability that will be used
throws:
  SQLException - if holdability is not one of the defined values




xlateRSType
int xlateRSType(int type) throws SQLException(Code)
Translates ResultSet type, adding to the warning chain if the requested type is downgraded.

Up to and including HSQLDB 1.7.2, TYPE_FORWARD_ONLY and TYPE_SCROLL_INSENSITIVE are passed through.

Starting with 1.7.2, while TYPE_SCROLL_SENSITIVE is downgraded to TYPE_SCROLL_INSENSITIVE and an SQLWarning is issued.


Parameters:
  type - of ResultSet; one ofjdbcResultSet.TYPE_XXX the actual type that will be used
throws:
  SQLException - if type is not one of the defined values




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.