类 DataHelper
java.lang.Object
com.gdxsoft.easyweb.datasource.DataHelper
这是一个与数据库联系的类,它与数据库连接,数据库查询,插入更新.
它是其它与数据库联系类的超类.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclose()关闭数据库连接static voidClose all datasources created and clear the DATASOURCES map to avoid classloader leaks on webapp reload.static voidcloseDataSource(String configName) 关闭指定名称的连接池并清理缓存booleanconnect()连接到数据库 优化:在获取锁前先检查缓存,减少不必要的同步开销。获取 CallableStatement 对象获取错误信息获取 PreparedStatement 对象获取 PreparedStatement 对象,并且设置为自动返回自增主键获取 Statement 对象voidsetConnection(Connection connection) 外部设置 数据库连接
-
构造器详细资料
-
DataHelper
-
-
方法详细资料
-
closeAllDataSources
public static void closeAllDataSources()Close all datasources created and clear the DATASOURCES map to avoid classloader leaks on webapp reload. -
getConnection
-
setConnection
-
connect
-
getStatement
-
getPreparedStatement
获取 PreparedStatement 对象- 参数:
sql-- 返回:
- 抛出:
Exception
-
getPreparedStatementAutoIncrement
获取 PreparedStatement 对象,并且设置为自动返回自增主键- 参数:
sql-- 返回:
- 抛出:
Exception
-
getCallableStatement
获取 CallableStatement 对象- 参数:
sql-- 返回:
- 抛出:
Exception
-
closeDataSource
关闭指定名称的连接池并清理缓存- 参数:
configName- 配置名称,如 "sqlprofiler_1"
-
close
public void close()关闭数据库连接 -
getErrorMsg
-