java.sql.Connection interface

A Derby Connection object is not garbage-collected until all other JDBC objects created from that connection are explicitly closed or are themselves garbage-collected. Once the connection is closed, no further JDBC requests can be made against objects created from the connection. Do not explicitly close the Connection object until you no longer need it for executing statements.

A session-severity or higher exception causes the connection to close and all other JDBC objects against it to be closed. System-severity exceptions cause the Derby system to shut down, which not only closes the connection but means that no new connections should be created in the current JVM.

Table 1. Implementation Notes on Connection Methods
Returns Signature Implementation Notes
PreparedStatement prepareStatement(String sql, int [] columnIndexes) Every column index in the array must correlate to an auto-increment column within the target table of the INSERT. Supported in embedded mode only.
PreparedStatement prepareStatement(String sql, String [] columnNames) Every column name in the array must designate an auto-increment column within the target table of the INSERT. Supported in embedded mode only.

See Autogenerated keys for details on the use of the two forms of the Connection.prepareStatement method shown in this table.

Related concepts
Core JDBC java.sql classes, interfaces, and methods
Related reference
java.sql.Driver interface
java.sql.DriverManager.getConnection method
java.sql.DatabaseMetaData interface
java.sql.Statement interface
java.sql.CallableStatement interface
java.sql.SQLException class
java.sql.PreparedStatement interface
java.sql.ResultSet interface
java.sql.ResultSetMetaData interface
java.sql.SQLWarning class
java.sql.SQLXML interface
java.sql.Savepoint interface
Mapping of java.sql.Types to SQL types
java.sql.BatchUpdateException class
JDBC Package for Connected Device Configuration/Foundation Profile (JSR169)
JDBC 4.0-only features
JDBC escape syntax