|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jabb.util.db.ConnectionUtility
public class ConnectionUtility
数据库连接工具,它提供有关数据库连接获取、关闭的方法。 它用到commons-logging来记录执行情况。
| Field Summary | |
|---|---|
protected static Properties |
configuration
|
protected static HashMap<String,DataSourceProvider> |
dataSourceProviders
|
protected static HashMap<String,DataSource> |
dataSources
|
protected static Object |
dataSourcesStructureLock
|
static String |
DELIMITORS
|
static String |
PROVIDER_PROPERTY_NAME
|
static String |
ROOT_CONFIGURATION_FILE
|
| Constructor Summary | |
|---|---|
ConnectionUtility()
|
|
| Method Summary | |
|---|---|
static void |
closeConnection(Connection conn)
Closes database Connection. |
static void |
closeConnection(Connection conn,
Statement st)
Close database connection and statement. |
static void |
closeConnection(Connection conn,
Statement st,
ResultSet... rss)
|
static void |
closeConnection(Connection conn,
Statement st,
ResultSet rs)
|
static void |
closeConnection(Connection conn,
Statement st,
ResultSet rs1,
ResultSet rs2)
|
static void |
closeConnection(Connection conn,
Statement st,
ResultSet rs1,
ResultSet rs2,
ResultSet rs3)
|
static void |
closeConnection(Connection conn,
Statement st1,
Statement st2)
|
static void |
closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet... rss)
|
static void |
closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet rs)
|
static void |
closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet rs1,
ResultSet rs2)
|
static void |
closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet rs1,
ResultSet rs2,
ResultSet rs3)
|
static void |
closeResultSet(ResultSet rs)
Closes database ResultSet No exception will be thrown even if occurred during closing, instead, the exception will be logged at warning level. |
static void |
closeStatement(Statement st)
Closes database Statement. |
protected static DataSource |
createDataSource(String source)
为指定的逻辑数据库源创建DataSource。 |
static int |
getBatchUpdateCount(int[] batchExecuteResult)
获得Statement.executeBatch()所修改的总记录数。 |
static Connection |
getConnection(String source)
从指定的逻辑数据库源中获取数据库连接。 |
static DataSource |
getDataSource(String source)
为指定的逻辑数据库源获取实际可用的DataSource。 |
protected static void |
readConfiguration()
读取配置信息 |
protected static void |
setupDataSourceProviders()
根据配置信息,初始化DataSourceProvider。 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ROOT_CONFIGURATION_FILE
public static final String PROVIDER_PROPERTY_NAME
public static final String DELIMITORS
protected static Properties configuration
protected static HashMap<String,DataSource> dataSources
protected static Object dataSourcesStructureLock
protected static HashMap<String,DataSourceProvider> dataSourceProviders
| Constructor Detail |
|---|
public ConnectionUtility()
| Method Detail |
|---|
protected static void readConfiguration()
protected static void setupDataSourceProviders()
public static Connection getConnection(String source)
throws SQLException
source -
SQLExceptionpublic static DataSource getDataSource(String source)
source -
protected static DataSource createDataSource(String source)
source - 配置信息
public static int getBatchUpdateCount(int[] batchExecuteResult)
batchExecuteResult - Statement.executeBatch()所返回的数组
public static void closeConnection(Connection conn)
conn - database connection that need to be closedpublic static void closeStatement(Statement st)
st - the Statement that need to be closedpublic static void closeResultSet(ResultSet rs)
rs - the ResultSet that need to be closed
public static void closeConnection(Connection conn,
Statement st)
conn - st -
public static void closeConnection(Connection conn,
Statement st1,
Statement st2)
public static void closeConnection(Connection conn,
Statement st,
ResultSet rs)
public static void closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet rs)
public static void closeConnection(Connection conn,
Statement st,
ResultSet rs1,
ResultSet rs2)
public static void closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet rs1,
ResultSet rs2)
public static void closeConnection(Connection conn,
Statement st,
ResultSet rs1,
ResultSet rs2,
ResultSet rs3)
public static void closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet rs1,
ResultSet rs2,
ResultSet rs3)
public static void closeConnection(Connection conn,
Statement st,
ResultSet... rss)
public static void closeConnection(Connection conn,
Statement st1,
Statement st2,
ResultSet... rss)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||