⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdbcconnection.java

📁 一个用java写的开源的数据库系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * This attribute is used only for {@link #STANDALONE STANDALONE}     * or {@link #INTERNAL INTERNAL} type connections. <p>     */    Session cSession;    /**     * A map from database names to open in-process {@link Database     * Database} instances. <p>     *     * This attribute is used to track and close open in-process     * <code>Database</code> instances, when it is detected that they     * no longer have any open connections. <p>     */    private static Hashtable tDatabase = new Hashtable();    /**     *  A map from each open in-process {@link Database Database} to a     *  count of its open connections. <p>     *     *  This attribute is used to track and close open in-process     *  <code>Database</code> instances, when it is detected that they     *  no longer have any open connections. <p>     *     *     */    private static Hashtable iUsageCount = new Hashtable();// ---------------- HSQLDB Protocol Network Connection Attributes ------------    /**     * The network <code>Socket</code> used communicate with this     * connection's {@link Database Database}. <p>     *     * This attribute is used only for {@link #HSQLDB HSQLDB} type     * connections. <p>     */    Socket sSocket;    /**     * The stream used to send requests to this connection's {@link     * Database Database}. <p>     *     * This attribute is used only for {@link #HSQLDB HSQLDB} type     * connections. <p>     */    DataOutputStream dOutput;    /**     * The stream used to receive results from this connection's     * {@link Database Database}. <p>     *     * This attribute is used only for {@link #HSQLDB HSQLDB} type     * connections. <p>     */    DataInputStream dInput;    /**     *  Used when no port is explicitly specified in the url for a     *  network <code>Connection</code> of type {@link #HSQLDB     *  HSQLDB}. <p>     *     *  This value is used as the port number for network connections     *  to {@link Server Server} mode databases, when no port number     *  is explictly specified in the connection url. <p>     *     *  In the standard distribution, this will always be <code><b>9001</b>     *  </code>.     */    public final static int DEFAULT_HSQLDB_PORT = 9001;// ---------------- HTTP Protocol Network Connection Attributes -------------    /**     *  The http url of this connection's {@link WebServer WebServer}     *  mode {@link Database Database}, when this connection is of     *  type {@link #HTTP HTTP}. <p>     *     *     */    private String sConnect;    /**     *  The logon name for a connection to a {@link WebServer     *  WebServer} mode <code>Database</code>. <p>     *     *  This is the user name that this connection uses to log on to     *  its <code>Database</code>, when this connection is of type     *  {@link #HTTP HTTP}. <p>     *     *     */    private String sUser;    /**     *  The password this connection uses to log on to its {@link     *  WebServer WebServer} mode <code>Database</code>, when this     *  connection is of type {@link #HTTP HTTP}. <p>     *     *     */    private String sPassword;    /**     *  The encoding used to communicate with a {@link WebServer     *  WebServer} mode {@link Database Database}, when this     *  connection is of type {@link #HTTP HTTP}. <p>     *     *  In the standard distribution, this will always be     *  <code class="JavaStringLiteral">"8859_1"</code>     */    final static String ENCODING = "8859_1";// ----------------------------------- JDBC 1 -------------------------------    /**     * <!-- start generic documentation -->     * Creates a <code>Statement</code>     * object for sending SQL statements to the database. SQL     * statements without parameters are normally executed using     * <code>Statement</code> objects. If the same SQL statement is     * executed many times, it may be more efficient to use a     * <code>PreparedStatement</code> object.<p>     *     * Result sets created using the returned <code>Statement</code>     * object will by default be type <code>TYPE_FORWARD_ONLY</code>     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.<p>     *     * <!-- end generic documentation -->     * <!-- start release-specific documentation -->     * <span class="ReleaseSpecificDocumentation">     * <b>HSQLDB-Specific Information:</b> <p>     *     * The standard java.sql API documentation above suggests that if     * the same SQL statement is executed many times, it may be more     * efficient to use a <code>PreparedStatement</code> object. As     * of HSQLDB 1.7.0, this is still not the case. However, this     * feature <I>is</I> slated to be part of the HSQLDB 1.7.x     * series. <p>     *     * Up to 1.6.1, HSQLDB supported <code>TYPE_FORWARD_ONLY</code> -     * <code>CONCUR_READ_ONLY</code> results only, so <code>ResultSet</code>     * objects created using the returned <code>Statement</code>     * object would <I>always</I> be type <code>TYPE_FORWARD_ONLY</code>     * with <code>CONCUR_READ_ONLY</code> concurrency. <p>     *     * Starting with 1.7.0, HSQLDB also supports     * <code>TYPE_SCROLL_INSENSITIVE</code> results. <p>     *     * <b>Notes:</b> <p>     *     * Up to 1.6.1, calling this method returned <code>null</code> 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     * <code>SQLException</code> if the connection is closed. <p>     *     * </span> <!-- end release-specific documentation -->     *     * @return a new default Statement object     * @throws SQLException if a database access error occurs<p>     * @see #createStatement(int,int)     * @see #createStatement(int,int,int)     */    public Statement createStatement() throws SQLException {        if (Trace.TRACE) {            Trace.trace();        }        checkClosed();        return new jdbcStatement(this);    }    /**     * <!-- start generic documentation -->     * Creates a <code>PreparedStatement</code>     * object for sending parameterized SQL statements to the     * database. <p>     *     * A SQL statement with or without IN parameters can be     * pre-compiled and stored in a <code>PreparedStatement</code>     * object. This object can then be used to efficiently execute     * this statement multiple times. <p>     *     * <B>Note:</B> This method is optimized for handling parametric     * SQL statements that benefit from precompilation. If the driver     * supports precompilation, the method <code>prepareStatement</code>     * 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     * <code>PreparedStatement</code> object is executed. This has no     * direct effect on users; however, it does affect which methods     * throw certain <code>SQLException</code> objects.<p>     *     * Result sets created using the returned <code>PreparedStatement</code>     * object will by default be type <code>TYPE_FORWARD_ONLY</code>     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.<p>     *     * <!-- end generic documentation -->     * <!-- start release-specific documentation -->     * <span class="ReleaseSpecificDocumentation">     * <b>HSQLDB-Specific Information:</b> <p>     *     * The standard java.sql API documentation above suggests that if     * the same SQL statement is executed many times, it may be more     * efficient to use a <code>PreparedStatement</code> object. As     * of HSQLDB 1.7.0, this is still not the case. Rather, the     * statement is stored on the client and is not sent to the     * database until the <code>PreparedStatement</code> object is     * executed. However, precompilation on the database <I>is</I> a     * feature slated to be part of the 1.7.x series. <p>     *     * Up to 1.6.1, HSQLDB supported <code>TYPE_FORWARD_ONLY</code> -     * <code>CONCUR_READ_ONLY</code> results only, so <code>ResultSet</code>     * objects created using the returned <code>PreparedStatement</code>     * object would <I>always</I> be type <code>TYPE_FORWARD_ONLY</code>     * with <code>CONCUR_READ_ONLY</code> concurrency. <p>     *     * Starting with 1.7.0, HSQLDB also supports     * <code>TYPE_SCROLL_INSENSITIVE</code> results. <p>     *     * <b>Notes:</b> <p>     *     * Up to 1.6.1, calling this method returned <code>null</code> 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     * <code>SQLException</code> if the connection is closed. <p>     *     * </span> <!-- end release-specific documentation -->     *     * @param sql an SQL statement that may contain one or more '?'     *    IN parameter placeholders     * @return a new default <code>PreparedStatement</code> object     *    containing the pre-compiled SQL statement     * @exception SQLException if a database access error occurs <p>     * @see #prepareStatement(String,int,int)     */    public PreparedStatement prepareStatement(String sql)    throws SQLException {        if (Trace.TRACE) {            Trace.trace(sql);        }        checkClosed();        return new jdbcPreparedStatement(this, sql);    }    /**     * <!-- start generic documentation -->     * Creates a <code>CallableStatement</code>     * object for calling database stored procedures. The     * <code>CallableStatement</code> object provides methods for setting up     * its IN and OUT  parameters, and methods for executing the call to a     * stored procedure. <p>     *     * <b>Note:</b> This method is optimized for handling stored     * procedure call statements. Some drivers may send the call     * statement to the database when the method <code>prepareCall</code>     * is done; others may wait until the <code>CallableStatement</code>     * object is executed. This has no direct effect on users;     * however, it does affect which method throws certain     * SQLExceptions. <p>     *     * Result sets created using the returned <code>CallableStatement</code>     * object will by default be type <code>TYPE_FORWARD_ONLY</code>     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.<p>     *     * <!-- end generic documentation -->     * <!-- start release-specific documentation -->     * <span class="ReleaseSpecificDocumentation">     * <b>HSQLDB-Specific Information:</b> <p>     *     * The standard java.sql API documentation above suggests that if     * the same stored procedure is executed many times, it may be     * more efficient to use a <code>CallableStatement</code> object.     * As of HSQLDB 1.7.0, this is still not the case. Rather, the     * statement is stored on the client and is not sent to the     * database until the <code>CallableStatement</code> object is     * executed. However, protocol optimizations and statement     * precompilation on the database for optimization of stored     * procedure execution <I>are</I> a features slated to be part of     * the 1.7.x series. <p>     *     * Up to and including 1.7.1, HSQLDB supports only the default     * <code>TYPE_FORWARD_ONLY</code> - <code>CONCUR_READ_ONLY</code> for     * results obtained from <code>CallableStatement</code> objects. <p>     *     * <B>Notes:</B> <p>     *     * Up to 1.6.1, calling this method returned <code>null</code> 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 <code>SQLException</code> if the connection is closed.<p>     *     * Up to and including 1.7.1, each HSQLDB stored procedure returns     * only a single value wrapped in a <code>ResultSet</code> object. That     * is, HSQLDB stored procedures act very much like SQL functions     * and can actually always be used in such a capacity. As such,     * there is really no point in supporting anything but     * <code>TYPE_FORWARD_ONLY</code>, since the result obtained by     * executing a <code>CallableStatement</code> object has     * always just one column and one row.  Be aware that this     * behaviour will change in HSQLDB 1.7.1, in that support will be     * added for Java stored procedures that return multi-column,     * multi-row results. At that point, support will be added for     * <code>CallableStatement</code> objects that return     * <code>TYPE_SCROLL_INSENSITIVE</code> <code>ResultSet</code>     * objects. <p>     *     * New to 1.7.0, HSQLDB now allows calling <code>void</code> Java     * methods as SQL functions and stored procedures, the result being     * a SQL <code>NULL</code> value or a result with one column and one     * row whose single field is the SQL <code>NULL</code> value,     * respectiviely.  Previously, calling such Java methods     * in either context resulted in throwing a <CODE>SQLException</CODE>.     *     * Finally, up to and including 1.7.1, the returned     * <code>CallableStatement</code> object does not support any     * getXXX methods. That is, HSQLDB stored procedures do not     * support <CODE>OUT</CODE> or <CODE>IN OUT</CODE> parameters. This     * behaviour <I>may</I> change at some point in the 1.7.x series, but     * no decisions have yet been made. <p>     *     * </span> <!-- end release-specific documentation -->     *     * @param sql a String object that is the SQL statement to be

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -