tot.db
类 DBUtils

java.lang.Object
  继承者 tot.db.DBUtils

public final class DBUtils
extends java.lang.Object


字段摘要
static int DATABASE_ACCESS
           
static int DATABASE_DB2
           
static int DATABASE_FIREBIRD
           
static int DATABASE_GENERAL
           
static int DATABASE_HSQLDB
           
static int DATABASE_IMFORMIX
           
static int DATABASE_INTERBASE
           
static int DATABASE_MYSQL
           
static int DATABASE_NOSCROLL
           
static int DATABASE_ORACLE
           
static int DATABASE_POSTGRESQL
           
static int DATABASE_SAPDB
           
static int DATABASE_SQLSERVER
           
static int DATABASE_SYBASE
           
static int DATABASE_UNKNOWN
           
 
方法摘要
static boolean closeAllConnections()
          Close all the connections that currently in the pool This method could be used to refresh the database connection
static void closeConnection(java.sql.Connection connection)
          Use this method to return the connection to the connection pool Do not use this method to close connection that is not from the connection pool
static void closePrepareStatement(java.sql.PreparedStatement ps)
          Use this method to close the PrepareStatement
static void closeResultSet(java.sql.ResultSet rs)
          Use this method to close the ResultSet
static void closeStatement(java.sql.Statement statement)
          Use this method to close the Statement
static java.sql.Connection getConnection()
          Get a connection from the connection pool.
static int getDatabaseType()
          Use this method to get the database type.
static java.lang.String getDatabaseTypeName(int databaseType)
           
static void resetStatement(java.sql.Statement statement)
          Use this method to reset the MaxRows and FetchSize of the Statement to the default values
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

DATABASE_UNKNOWN

public static final int DATABASE_UNKNOWN
另请参见:
常量字段值

DATABASE_GENERAL

public static final int DATABASE_GENERAL
另请参见:
常量字段值

DATABASE_NOSCROLL

public static final int DATABASE_NOSCROLL
另请参见:
常量字段值

DATABASE_ORACLE

public static final int DATABASE_ORACLE
另请参见:
常量字段值

DATABASE_SQLSERVER

public static final int DATABASE_SQLSERVER
另请参见:
常量字段值

DATABASE_DB2

public static final int DATABASE_DB2
另请参见:
常量字段值

DATABASE_SYBASE

public static final int DATABASE_SYBASE
另请参见:
常量字段值

DATABASE_IMFORMIX

public static final int DATABASE_IMFORMIX
另请参见:
常量字段值

DATABASE_MYSQL

public static final int DATABASE_MYSQL
另请参见:
常量字段值

DATABASE_POSTGRESQL

public static final int DATABASE_POSTGRESQL
另请参见:
常量字段值

DATABASE_HSQLDB

public static final int DATABASE_HSQLDB
另请参见:
常量字段值

DATABASE_ACCESS

public static final int DATABASE_ACCESS
另请参见:
常量字段值

DATABASE_SAPDB

public static final int DATABASE_SAPDB
另请参见:
常量字段值

DATABASE_INTERBASE

public static final int DATABASE_INTERBASE
另请参见:
常量字段值

DATABASE_FIREBIRD

public static final int DATABASE_FIREBIRD
另请参见:
常量字段值
方法详细信息

getDatabaseType

public static int getDatabaseType()
Use this method to get the database type. This method will automatically detect the database type. You could override this value by modifying the value in mvncore_db_DBOptions.properties

返回:
: the database type

getDatabaseTypeName

public static java.lang.String getDatabaseTypeName(int databaseType)

getConnection

public static java.sql.Connection getConnection()
                                         throws java.sql.SQLException
Get a connection from the connection pool. The returned connection must be closed by calling DBUtils.closeConnection()

返回:
: a new connection from the pool if succeed
抛出:
java.sql.SQLException - : if cannot get a connection from the pool

closeAllConnections

public static boolean closeAllConnections()
Close all the connections that currently in the pool This method could be used to refresh the database connection

返回:
true if the pool is empty and balance false if the pool has returned some connection to outside

closeConnection

public static void closeConnection(java.sql.Connection connection)
Use this method to return the connection to the connection pool Do not use this method to close connection that is not from the connection pool

参数:
connection - : the connection that needs to be returned to the pool

resetStatement

public static void resetStatement(java.sql.Statement statement)
Use this method to reset the MaxRows and FetchSize of the Statement to the default values

参数:
statement - : the statement that needs to be reseted

closeStatement

public static void closeStatement(java.sql.Statement statement)
Use this method to close the Statement

参数:
statement - : the statement that needs to be closed

closePrepareStatement

public static void closePrepareStatement(java.sql.PreparedStatement ps)
Use this method to close the PrepareStatement

参数:
ps - : the statement that needs to be closed

closeResultSet

public static void closeResultSet(java.sql.ResultSet rs)
Use this method to close the ResultSet

参数:
rs - : the resultset that needs to be closed