📄 connection.java
字号:
* a subspace of this <code>Connection</code> object's database * in which to work. * <P> * If the driver does not support catalogs, it will * silently ignore this request. * * @param catalog the name of a catalog (subspace in this * <code>Connection</code> object's database) in which to work * @exception SQLException if a database access error occurs * @see #getCatalog */ void setCatalog(String catalog) throws SQLException; /** * Retrieves this <code>Connection</code> object's current catalog name. * * @return the current catalog name or <code>null</code> if there is none * @exception SQLException if a database access error occurs * @see #setCatalog */ String getCatalog() throws SQLException; /** * A constant indicating that transactions are not supported. */ int TRANSACTION_NONE = 0; /** * A constant indicating that * dirty reads, non-repeatable reads and phantom reads can occur. * This level allows a row changed by one transaction to be read * by another transaction before any changes in that row have been * committed (a "dirty read"). If any of the changes are rolled back, * the second transaction will have retrieved an invalid row. */ int TRANSACTION_READ_UNCOMMITTED = 1; /** * A constant indicating that * dirty reads are prevented; non-repeatable reads and phantom * reads can occur. This level only prohibits a transaction * from reading a row with uncommitted changes in it. */ int TRANSACTION_READ_COMMITTED = 2; /** * A constant indicating that * dirty reads and non-repeatable reads are prevented; phantom * reads can occur. This level prohibits a transaction from * reading a row with uncommitted changes in it, and it also * prohibits the situation where one transaction reads a row, * a second transaction alters the row, and the first transaction * rereads the row, getting different values the second time * (a "non-repeatable read"). */ int TRANSACTION_REPEATABLE_READ = 4; /** * A constant indicating that * dirty reads, non-repeatable reads and phantom reads are prevented. * This level includes the prohibitions in * <code>TRANSACTION_REPEATABLE_READ</code> and further prohibits the * situation where one transaction reads all rows that satisfy * a <code>WHERE</code> condition, a second transaction inserts a row that * satisfies that <code>WHERE</code> condition, and the first transaction * rereads for the same condition, retrieving the additional * "phantom" row in the second read. */ int TRANSACTION_SERIALIZABLE = 8; /** * Attempts to change the transaction isolation level for this * <code>Connection</code> object to the one given. * The constants defined in the interface <code>Connection</code> * are the possible transaction isolation levels. * <P> * <B>Note:</B> If this method is called during a transaction, the result * is implementation-defined. * * @param level one of the following <code>Connection</code> constants: * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, * <code>Connection.TRANSACTION_READ_COMMITTED</code>, * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or * <code>Connection.TRANSACTION_SERIALIZABLE</code>. * (Note that <code>Connection.TRANSACTION_NONE</code> cannot be used * because it specifies that transactions are not supported.) * @exception SQLException if a database access error occurs * or the given parameter is not one of the <code>Connection</code> * constants * @see DatabaseMetaData#supportsTransactionIsolationLevel * @see #getTransactionIsolation */ void setTransactionIsolation(int level) throws SQLException; /** * Retrieves this <code>Connection</code> object's current * transaction isolation level. * * @return the current transaction isolation level, which will be one * of the following constants: * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, * <code>Connection.TRANSACTION_READ_COMMITTED</code>, * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, * <code>Connection.TRANSACTION_SERIALIZABLE</code>, or * <code>Connection.TRANSACTION_NONE</code>. * @exception SQLException if a database access error occurs * @see #setTransactionIsolation */ int getTransactionIsolation() throws SQLException; /** * Retrieves the first warning reported by calls on this * <code>Connection</code> 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 * <code>SQLWarning.getNextWarning</code> on the warning * that was retrieved previously. * <P> * This method may not be * called on a closed connection; doing so will cause an * <code>SQLException</code> to be thrown. * * <P><B>Note:</B> Subsequent warnings will be chained to this * SQLWarning. * * @return the first <code>SQLWarning</code> object or <code>null</code> * if there are none * @exception SQLException if a database access error occurs or * this method is called on a closed connection * @see SQLWarning */ SQLWarning getWarnings() throws SQLException; /** * Clears all warnings reported for this <code>Connection</code> object. * After a call to this method, the method <code>getWarnings</code> * returns <code>null</code> until a new warning is * reported for this <code>Connection</code> object. * * @exception SQLException if a database access error occurs */ void clearWarnings() throws SQLException; //--------------------------JDBC 2.0----------------------------- /** * Creates a <code>Statement</code> object that will generate * <code>ResultSet</code> objects with the given type and concurrency. * This method is the same as the <code>createStatement</code> method * above, but it allows the default result set * type and concurrency to be overridden. * * @param resultSetType a result set type; one of * <code>ResultSet.TYPE_FORWARD_ONLY</code>, * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> * @param resultSetConcurrency a concurrency type; one of * <code>ResultSet.CONCUR_READ_ONLY</code> or * <code>ResultSet.CONCUR_UPDATABLE</code> * @return a new <code>Statement</code> object that will generate * <code>ResultSet</code> objects with the given type and * concurrency * @exception SQLException if a database access error occurs * or the given parameters are not <code>ResultSet</code> * constants indicating type and concurrency * @since 1.2 */ Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException; /** * * Creates a <code>PreparedStatement</code> object that will generate * <code>ResultSet</code> objects with the given type and concurrency. * This method is the same as the <code>prepareStatement</code> method * above, but it allows the default result set * type and concurrency to be overridden. * * @param sql a <code>String</code> object that is the SQL statement to * be sent to the database; may contain one or more ? IN * parameters * @param resultSetType a result set type; one of * <code>ResultSet.TYPE_FORWARD_ONLY</code>, * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> * @param resultSetConcurrency a concurrency type; one of * <code>ResultSet.CONCUR_READ_ONLY</code> or * <code>ResultSet.CONCUR_UPDATABLE</code> * @return a new PreparedStatement object containing the * pre-compiled SQL statement that will produce <code>ResultSet</code> * objects with the given type and concurrency * @exception SQLException if a database access error occurs * or the given parameters are not <code>ResultSet</code> * constants indicating type and concurrency * @since 1.2 */ PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException; /** * Creates a <code>CallableStatement</code> object that will generate * <code>ResultSet</code> objects with the given type and concurrency. * This method is the same as the <code>prepareCall</code> method * above, but it allows the default result set * type and concurrency to be overridden. * * @param sql a <code>String</code> object that is the SQL statement to * be sent to the database; may contain on or more ? parameters * @param resultSetType a result set type; one of * <code>ResultSet.TYPE_FORWARD_ONLY</code>, * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> * @param resultSetConcurrency a concurrency type; one of * <code>ResultSet.CONCUR_READ_ONLY</code> or * <code>ResultSet.CONCUR_UPDATABLE</code> * @return a new <code>CallableStatement</code> object containing the * pre-compiled SQL statement that will produce <code>ResultSet</code> * objects with the given type and concurrency * @exception SQLException if a database access error occurs * or the given parameters are not <code>ResultSet</code> * constants indicating type and concurrency * @since 1.2 */ CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException; /** * Retrieves the <code>Map</code> object associated with this * <code>Connection</code> object. * Unless the application has added an entry, the type map returned * will be empty. * * @return the <code>java.util.Map</code> object associated * with this <code>Connection</code> object * @exception SQLException if a database access error occurs * @since 1.2 * @see #setTypeMap */ java.util.Map getTypeMap() throws SQLException; /** * Installs the given <code>TypeMap</code> object as the type map for * this <code>Connection</code> object. The type map will be used for the * custom mapping of SQL structured types and distinct types. * * @param map the <code>java.util.Map</code> object to install * as the replacement for this <code>Connection</code> * object's default type map * @exception SQLException if a database access error occurs or * the given parameter is not a <code>java.util.Map</code> * object * @since 1.2 * @see #getTypeMap */ void setTypeMap(java.util.Map map) throws SQLException; //--------------------------JDBC 3.0----------------------------- /** * Changes the holdability of <code>ResultSet</code> objects * created using this <code>Connection</code> object to the given * holdability. * * @param holdability a <code>ResultSet</code> holdability constant; one of * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> * @throws SQLException if a database access occurs, the given parameter * is not a <code>ResultSet</code> constant indicating holdability, * or the given holdability is not supported * @see #getHoldability * @see ResultSet * @since 1.4 */ void setHoldability(int holdability) throws SQLException; /** * Retrieves the current holdability of <code>ResultSet</code> objects * created using this <code>Connection</code> object. * * @return the holdability, one of * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> * @throws SQLException if a database access occurs * @see #setHoldability * @see ResultSet * @since 1.4 */ int getHoldability() throws SQLException; /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -