dbconnectionmanager.html
来自「开源软件openfire的API文件。进行openfire的二次开发所必需的工具」· HTML 代码 · 共 1,070 行 · 第 1/4 页
HTML
1,070 行
} </pre><P><DD><DL><DT><B>Parameters:</B><DD><CODE>rs</CODE> - the result set to close.</DL></DD></DL><HR><A NAME="closeStatement(java.sql.Statement)"><!-- --></A><H3>closeStatement</H3><PRE>public static void <B>closeStatement</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html" title="class or interface in java.sql">Statement</A> stmt)</PRE><DL><DD>Closes a statement. This method should be called within the finally section of your database logic, as in the following example: <pre> public void doSomething(Connection con) { PreparedStatement pstmt = null; try { pstmt = con.prepareStatement("select * from blah"); .... } catch (SQLException sqle) { Log.error(sqle); } finally { ConnectionManager.closePreparedStatement(pstmt); } } </pre><P><DD><DL><DT><B>Parameters:</B><DD><CODE>stmt</CODE> - the statement.</DL></DD></DL><HR><A NAME="closeConnection(java.sql.ResultSet, java.sql.Statement, java.sql.Connection)"><!-- --></A><H3>closeConnection</H3><PRE>public static void <B>closeConnection</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html" title="class or interface in java.sql">ResultSet</A> rs, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html" title="class or interface in java.sql">Statement</A> stmt, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html" title="class or interface in java.sql">Connection</A> con)</PRE><DL><DD>Closes a result set, statement and database connection (returning the connection to the connection pool). This method should be called within the finally section of your database logic, as in the following example: <pre> Connection con = null; PrepatedStatment pstmt = null; ResultSet rs = null; try { con = ConnectionManager.getConnection(); pstmt = con.prepareStatement("select * from blah"); rs = psmt.executeQuery(); .... } catch (SQLException sqle) { Log.error(sqle); } finally { ConnectionManager.closeConnection(rs, pstmt, con); }</pre><P><DD><DL><DT><B>Parameters:</B><DD><CODE>rs</CODE> - the result set.<DD><CODE>stmt</CODE> - the statement.<DD><CODE>con</CODE> - the connection.</DL></DD></DL><HR><A NAME="closeConnection(java.sql.Statement, java.sql.Connection)"><!-- --></A><H3>closeConnection</H3><PRE>public static void <B>closeConnection</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html" title="class or interface in java.sql">Statement</A> stmt, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html" title="class or interface in java.sql">Connection</A> con)</PRE><DL><DD>Closes a statement and database connection (returning the connection to the connection pool). This method should be called within the finally section of your database logic, as in the following example: <p/> <pre> Connection con = null; PrepatedStatment pstmt = null; try { con = ConnectionManager.getConnection(); pstmt = con.prepareStatement("select * from blah"); .... } catch (SQLException sqle) { Log.error(sqle); } finally { DbConnectionManager.closeConnection(pstmt, con); }</pre><P><DD><DL><DT><B>Parameters:</B><DD><CODE>stmt</CODE> - the statement.<DD><CODE>con</CODE> - the connection.</DL></DD></DL><HR><A NAME="closeConnection(java.sql.Connection)"><!-- --></A><H3>closeConnection</H3><PRE>public static void <B>closeConnection</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html" title="class or interface in java.sql">Connection</A> con)</PRE><DL><DD>Closes a database connection (returning the connection to the connection pool). Any statements associated with the connection should be closed before calling this method. This method should be called within the finally section of your database logic, as in the following example: <p/> <pre> Connection con = null; try { con = ConnectionManager.getConnection(); .... } catch (SQLException sqle) { Log.error(sqle); } finally { DbConnectionManager.closeConnection(con); }</pre><P><DD><DL><DT><B>Parameters:</B><DD><CODE>con</CODE> - the connection.</DL></DD></DL><HR><A NAME="createScrollableStatement(java.sql.Connection)"><!-- --></A><H3>createScrollableStatement</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html" title="class or interface in java.sql">Statement</A> <B>createScrollableStatement</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html" title="class or interface in java.sql">Connection</A> con) throws <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></PRE><DL><DD>Creates a scroll insensitive Statement if the JDBC driver supports it, or a normal Statement otherwise.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>con</CODE> - the database connection.<DT><B>Returns:</B><DD>a Statement<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></CODE> - if an error occurs.</DL></DD></DL><HR><A NAME="createScrollablePreparedStatement(java.sql.Connection, java.lang.String)"><!-- --></A><H3>createScrollablePreparedStatement</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html" title="class or interface in java.sql">PreparedStatement</A> <B>createScrollablePreparedStatement</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html" title="class or interface in java.sql">Connection</A> con, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> sql) throws <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></PRE><DL><DD>Creates a scroll insensitive PreparedStatement if the JDBC driver supports it, or a normal PreparedStatement otherwise.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>con</CODE> - the database connection.<DD><CODE>sql</CODE> - the SQL to create the PreparedStatement with.<DT><B>Returns:</B><DD>a PreparedStatement<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></CODE> - if an error occurs.</DL></DD></DL><HR><A NAME="scrollResultSet(java.sql.ResultSet, int)"><!-- --></A><H3>scrollResultSet</H3><PRE>public static void <B>scrollResultSet</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html" title="class or interface in java.sql">ResultSet</A> rs, int rowNumber) throws <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></PRE><DL><DD>Scrolls forward in a result set the specified number of rows. If the JDBC driver supports the feature, the cursor will be moved directly. Otherwise, we scroll through results one by one manually by calling <tt>rs.next()</tt>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>rs</CODE> - the ResultSet object to scroll.<DD><CODE>rowNumber</CODE> - the row number to scroll forward to.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></CODE> - if an error occurs.</DL></DD></DL><HR><A NAME="getConnectionProvider()"><!-- --></A><H3>getConnectionProvider</H3><PRE>public static <A HREF="../../../org/jivesoftware/database/ConnectionProvider.html" title="interface in org.jivesoftware.database">ConnectionProvider</A> <B>getConnectionProvider</B>()</PRE><DL><DD>Returns the current connection provider. The only case in which this method should be called is if more information about the current connection provider is needed. Database connections should always be obtained by calling the getConnection method of this class.<P><DD><DL><DT><B>Returns:</B><DD>the connection provider.</DL></DD></DL><HR><A NAME="setConnectionProvider(org.jivesoftware.database.ConnectionProvider)"><!-- --></A><H3>setConnectionProvider</H3><PRE>public static void <B>setConnectionProvider</B>(<A HREF="../../../org/jivesoftware/database/ConnectionProvider.html" title="interface in org.jivesoftware.database">ConnectionProvider</A> provider)</PRE><DL><DD>Sets the connection provider. The old provider (if it exists) is shut down before the new one is started. A connection provider <b>should not</b> be started before being passed to the connection manager because the manager will call the start() method automatically.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>provider</CODE> - the ConnectionProvider that the manager should obtain connections from.</DL></DD></DL><HR><A NAME="destroyConnectionProvider()"><!-- --></A><H3>destroyConnectionProvider</H3><PRE>public static void <B>destroyConnectionProvider</B>()</PRE><DL><DD>Destroys the currennt connection provider. Future calls to <A HREF="../../../org/jivesoftware/database/DbConnectionManager.html#getConnectionProvider()"><CODE>getConnectionProvider()</CODE></A> will return <tt>null</tt> until a new ConnectionProvider is set, or one is automatically loaded by a call to <A HREF="../../../org/jivesoftware/database/DbConnectionManager.html#getConnection()"><CODE>getConnection()</CODE></A>.<P><DD><DL></DL></DD></DL><HR><A NAME="getLargeTextField(java.sql.ResultSet, int)"><!-- --></A><H3>getLargeTextField</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getLargeTextField</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html" title="class or interface in java.sql">ResultSet</A> rs, int columnIndex) throws <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></PRE><DL><DD>Retrives a large text column from a result set, automatically performing streaming if the JDBC driver requires it. This is necessary because different JDBC drivers have different capabilities and methods for retrieving large text values.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>rs</CODE> - the ResultSet to retrieve the text field from.<DD><CODE>columnIndex</CODE> - the column in the ResultSet of the text field.<DT><B>Returns:</B><DD>the String value of the text field.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></CODE> - if an SQL exception occurs.</DL></DD></DL><HR><A NAME="setLargeTextField(java.sql.PreparedStatement, int, java.lang.String)"><!-- --></A><H3>setLargeTextField</H3><PRE>public static void <B>setLargeTextField</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html" title="class or interface in java.sql">PreparedStatement</A> pstmt, int parameterIndex, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> value) throws <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/sql/SQLException.html" title="class or interface in java.sql">SQLException</A></PRE><DL><DD>Sets a large text column in a result set, automatically performing streaming if the JDBC driver requires it. This is necessary because
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?