Jdbc link database (including connection pooling)
/ *
* Copyright 2000-2020 YGSoft.Inc All Rights Reserved.
, /
Package com.ygsoft.gris.mapp.materialmanage.impl.util
Import java.math.BigDecimal
Import java.sql.CallableStatement
Import java.sql.Connection
Import java.sql.ResultSet
Import java.sql.SQLException
Import java.sql.Statement
Import java.text.DecimalFormat
Import java.text.NumberFormat
Import java.util.ArrayList
Import java.util.List
Import java.util.Map
Import com.ygsoft.ecp.service.tool.StringUtil
Import com.ygsoft.gris.mapp.materialmanage.service.model.EngineeringMaterialsOutVO
Import com.ygsoft.gris.mapp.materialmanage.service.model.QueryConditionsVO
Import com.ygsoft.gris.mapp.materialmanage.service.model.SupplierInvoiceInfoVO
Import com.ygsoft.gris.mapp.materialmanage.service.model.SupplierZanguSupplies
Import com.ygsoft.gris.mapp.materialmanage.service.model.Tm0001CatalogsVO
/ * *
* sqlService database connection.
*
* @ author mapengfei
* @ version 1.0.0 October 13, 2016
* @ see
* @ since JDK 1.5.0
, /
Public class SqlServerDbConnectionUtil {
Private static boolean ISTESTDATA = true
/ * *
* Internal lazy loading class.
*
* @ author mapengfei
* @ version 1.0.0 May 31, 2016
* @ see
* @ since JDK 1.5.0
, /
Private static class LazyHolder {
Private static final SqlServerDbConnectionUtil INSTANCE = new SqlServerDbConnectionUtil ()
}
/ * *
* New implementation of singleton
*
* @ return
, /
Public static final SqlServerDbConnectionUtil getInstance () {
Return LazyHolder.INSTANCE
}
/ * *
* @ param args
, /
Public static void main (final String [] args) {
/ / TODO Auto-generated method stub
/ / SqlServerDbConnectionUtil util = new SqlServerDbConnectionUtil ()
/ / util.dbConnection ()
/ / List list =
/ / SqlServerDbConnectionUtil.findAllMaterialsOutByCondition (null)
List list = findExcelExportByCondition (null, "ZGWZ")
System.out.println (list)
}
/ * *
* get database links
*
* @ return
, /
Private static Connection getCurrentConnecton () {
/ / initialize connection pooling
ConnectionPool pool = getPool ()
/ / get the current link
Connection conn = pool.getCurrentConnecton ()
If (conn! = null) {
Return conn
}
Return null
}
/ * *
* Singleton mode initializes a connection pool
*
* @ return
, /
Public static ConnectionPool getPool () {
Return ConnectionPoolManager.getInstance () .getPool (sqllitePool)
}
/ * *
* query according to conditions
*
* @ return
, /
Public static List findAllMaterialsOutByCondition (
Final QueryConditionsVO queryCondition) {
If (ISTESTDATA) {
Return TestData.findAllMaterialsOutByCondition (queryCondition)
}
List list = new ArrayList ()
Connection conn = null
Try {
Conn = getCurrentConnecton ()
Statement stat = conn.createStatement ()
String sql = setQueryConditionsSql (queryCondition, "CLCK", 1000)
ResultSet rs = stat.executeQuery (sql)
EngineeringMaterialsOutVO out = null
Int I = 1
While (rs.next ()) {
Out = new EngineeringMaterialsOutVO ()
Out.setNo ("" + I)
Out.setTotal (rs.getBigDecimal (7))
Out.setProDefinition (! StringUtil.isNotEmptyString (rs.getString (3))? "": rs.getString (3). ToString (); / / Engineering definition
Out.setNotTaxAmount (BigDecimal.valueOf (rs.getDouble (4)
Out.setProName (! StringUtil.isNotEmptyString (rs.getString (2))? "": rs.getString (2) .toString (); / / name
Out.setProNumber (! StringUtil.isNotEmptyString (rs.getString (1))? "": rs.getString (1) .toString (); / / Encoding
Out.setTax (rs.getDouble (6))
Out.setTaxRate (rs.getDouble (5))
List.add (out)
ITunes +
}
Rs.close ()
Stat.close ()
} catch (SQLException e) {
/ / TODO Auto-generated catch block
E.printStackTrace ()
} finally {
CloseConnection (conn)
}
Return list
}
/ * *
* summary of provisional estimated materials
*
* @ return
, /
Public static List findAllSupplierZanguSuppliesByCondition (
Final QueryConditionsVO queryCondition) {
If (ISTESTDATA) {
Return TestData.findAllSupplierZanguSuppliesByCondition (queryCondition)
}
List list = new ArrayList ()
Connection conn = null
Try {
Conn = getCurrentConnecton ()
Statement stat = conn.createStatement ()
String sql = setQueryConditionsSql (queryCondition, "ZGWZ", 1000)
ResultSet rs = stat.executeQuery (sql)
SupplierZanguSupplies out = null
Int I = 0
While (rs.next ()) {
Out = new SupplierZanguSupplies ()
Out.setNo ("" + I)
Out.setInStoragePrice (rs.getBigDecimal (3)); / / purchase price
Out.setInvoicePrice (rs.getBigDecimal (7)); / / invoice price
/ out.setNo (rs.getString (1))
Out.setNotInvoicePrice (rs.getBigDecimal (8)); / / not × × × price
Out.setPurAmount (rs.getBigDecimal (2)); / / purchase amount
Out.setSupplier (rs.getString (1))
Out.setTax (rs.getBigDecimal (5))
Out.setTaxRate (rs.getBigDecimal (4))
Out.setTotalPrice (rs.getBigDecimal (6)); / / Total import tax
List.add (out)
ITunes +
}
Rs.close ()
Stat.close ()
} catch (SQLException e) {
/ / TODO Auto-generated catch block
E.printStackTrace ()
} finally {
CloseConnection (conn)
}
Return list
}
/ * *
* Export data acquisition
*
* @ param supplier
* @ param startTime
* @ param endTime
* @ return
, /
Public static List findExcelExportByCondition (final QueryConditionsVO queryCondition
Final String type) {
If (ISTESTDATA) {
Return TestData.findExcelExportByCondition (queryCondition, type)
}
List list = new ArrayList ()
List tm001s = SqlServerDbConnectionUtil.findProductTypeAll ()
Connection conn = null
Try {
Conn = getCurrentConnecton ()
Statement stat = conn.createStatement ()
String sql = setQueryConditionsSql (queryCondition, type, 100000)
ResultSet rs = stat.executeQuery (sql)
ExcelModel out = null
Int col = rs.getMetaData () .getColumnCount ()
Int row = 1
While (rs.next ()) {
Out = new ExcelModel ()
List suns = new ArrayList ()
For (int I = 1; I
< col; i++) { // X轴 out = new ExcelModel(); Object obj = rs.getObject(i) != null ? rs.getObject(i) : ""; if ("FPXX".equals(type)) { // 发票 switch (i) { case 8: case 10: case 12: case 13: case 15: case 17: case 18: case 19: obj = formatMoney(obj.toString(), 2, true); break; case 11: obj = formatMoney(obj.toString(), 0, false) + "%"; break; case 9: case 14: case 16: obj = 0; if (StringUtil.isNotEmptyString(obj.toString())) { long num = Long.parseLong(obj.toString()); obj = num; } break; default: break; } out.setData(obj); } else if ("ZGWZ".equals(type)) { // 暂估物资 if (i == 1) { ExcelModel out_no = new ExcelModel(); out_no.setData(row); suns.add(out_no); } switch (i) { case 2: case 3: case 5: case 6: case 7: case 8: obj = formatMoney(obj.toString(), 2, true); break; case 4: obj = formatMoney(obj.toString(), 0, false) + "%"; break; default: break; } out.setData(obj); } else { switch (i) { case 5: // 税率 obj = formatMoney(obj.toString(), 0, false) + "%"; break; case 3: String newProtype = ""; Object proType = rs.getString("proType"); List protypes = new ArrayList(); for (Tm0001CatalogsVO c : tm001s) { if (proType.equals(c.getID())) { // 找到节点 newProtype += c.getDisplayName() + "-"; searchProType(tm001s, newProtype, c, protypes); } } obj = protypes.get(0); break; case 4: case 6: case 7: obj = (Object) formatMoney(obj.toString(), 2, true); break; default: out.setData(obj); break; } out.setData(obj); } suns.add(out); } out.setDataList(suns); list.add(out); row++; } rs.close(); stat.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { closeConnection(conn); } return list; } /** * 查询所有的项目分类 * * @return */ public static List findProductTypeAll() { if (ISTESTDATA) { return TestData.findProductTypeAll(); } // 获得测试数据 List list = new ArrayList(); Connection conn = null; try { conn = getCurrentConnecton(); Statement stat = conn.createStatement(); StringBuffer sql = new StringBuffer(" SELECT * FROM TM0001_Catalogs WHERE FieldID=109 "); ResultSet rs = stat.executeQuery(sql.toString()); Tm0001CatalogsVO out = null; while (rs.next()) { out = new Tm0001CatalogsVO(); out.setID(rs.getString(1)); out.setName(rs.getString(2)); out.setDisplayName(rs.getString(3)); out.setParentID(rs.getString(4)); out.setFieldID(rs.getString(5)); out.setObjectID(rs.getString(6)); out.setLevel(rs.getString(7)); out.setComment(rs.getString(8)); list.add(out); } rs.close(); stat.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { closeConnection(conn); } return list; } /** * 查询登录信息的方法 * * @return */ public Map getLoginNameAndStatus() { Connection conn = null; try { conn = getCurrentConnecton(); Statement stat = conn.createStatement(); StringBuffer sql = new StringBuffer(" SELECT * FROM TM0001_Catalogs WHERE FieldID=109 "); ResultSet rs = stat.executeQuery(sql.toString()); while (rs.next()) { } rs.close(); stat.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { closeConnection(conn); } return null; } /** * * @param newNoInvoiceTax * @return */ public static List findAllSupplierInvoiceInfoVOByCondition( final QueryConditionsVO queryCondition) { if (ISTESTDATA) { return TestData.findAllSupplierInvoiceInfoVOByCondition(queryCondition); } List list = new ArrayList(); Connection conn = null; try { conn = getCurrentConnecton(); Statement stat = conn.createStatement(); String sql = setQueryConditionsSql(queryCondition, "FPXX", 1000); ResultSet rs = stat.executeQuery(sql); SupplierInvoiceInfoVO out = null; int i = 1; while (rs.next()) { out = new SupplierInvoiceInfoVO(); out.setNo("" + i); out.setEngineeringCode(rs.getString(5)); // 工程编码 out.setEngineeringName(rs.getString(6)); // 工程名称 out.setInStorageAmount(rs.getBigDecimal(13)); // 入库金额 out.setInStorageNum(rs.getLong(9)); // 入库数量 out.setInStoreAmount(rs.getBigDecimal(10)); // 入库价款 out.setInvoiceAmount(rs.getBigDecimal(15)); // 发票金额 out.setInvoiceNum(rs.getLong(14)); // 发票数量 out.setMaterialCode(rs.getString(2)); // 物资编码 out.setMaterialName(rs.getString(3)); out.setNoInvoiceAmount(rs.getBigDecimal(17)); // 未开票金额 out.setNoInvoiceNum(rs.getLong(16)); // 未开票数量 out.setNoInvoiceTax(rs.getBigDecimal(18)); out.setPurAmount(rs.getBigDecimal(8)); // 采购金额 out.setPurQuantity(rs.getLong(7)); // 采购数量 out.setSpecificationsModel(rs.getString(4)); // 规格型号 out.setSupplier(rs.getString(1)); // 供应商 out.setTax(rs.getBigDecimal(12)); // 税款 out.setTaxRate(rs.getBigDecimal(11)); // 税率 out.setTotalPrice(rs.getBigDecimal(19)); // 价税合计 list.add(out); i++; } rs.close(); stat.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { closeConnection(conn); } return list; } /** * 测试连接 */ @SuppressWarnings("unused") private void dbConnection() { Connection conn = null; try { // Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); // String url = // "jdbc:sqlserver://192.168.0.2:1433;DatabaseName=msdb"; // conn = DriverManager.getConnection(url, "sa", "lxm226855"); conn = getCurrentConnecton(); Statement stat = conn.createStatement(); // String sql = "call // cq_gcclckhzb('1321','17','2013-10-21','2016-10-21')"; CallableStatement proc = conn.prepareCall("{call cq_gcclckhzb(?,?,?,?)}"); proc.setString(1, "1321"); proc.setString(2, "17"); proc.setString(3, "2013-10-21"); proc.setString(4, "2016-10-21"); // proc.registerOutParameter(5, Types.VARCHAR); proc.execute(); ResultSet rs = stat.executeQuery("select * from temp_cq_gcclckhzb"); int col = rs.getMetaData().getColumnCount(); while (rs.next()) { for (int i = 1; i -1 ? taxRates[i].substring(0, taxRates[i].length() - 1) : taxRates[i]); if (i != taxRates.length - 1) { sql.append(taxRate + ","); } else { sql.append(taxRate); } } sql.append(" )"); } if (StringUtil.isNotEmptyString(conditions.getProType())) { // 分类 String[] proTypes = conditions.getProType().split(","); sql.append(" and proType in ( "); for (int i = 0; i < proTypes.length; i++) { if (i != proTypes.length - 1) { sql.append("'" + proTypes[i] + "',"); } else { sql.append("'" + proTypes[i] + "'"); } } sql.append(" )"); } if (StringUtil.isNotEmptyString(conditions.getStartTime())) { // 起始日期 sql.append(" and BusinessDate >='"+ conditions.getStartTime () +"'")
}
If (StringUtil.isNotEmptyString (conditions.getEndTime () {/ / end date
Sql.append ("the maximum number set by and BusinessDate, where forced shutdown is taken")
}
Conn.close ()
}
}
/ * *
* determine whether the connection is available
*
* @ param conn
* @ return
, /
Private boolean isValid (final Connection conn) {
Try {
If (conn = = null | | conn.isClosed ()) {
Return false
}
} catch (SQLException e) {
If (LOG.isInfoEnabled ()) {
LOG.info ("an exception occurred while determining whether a connection is available")
}
E.printStackTrace ()
}
Return true
}
/ * *
* destroy the connection pool
, /
Public synchronized void destroy () {
/ * *
* destroy the free connection pool
, /
For (Connection conn: freeConnection) {
Try {
If (isValid (conn)) {
Conn.close ()
}
} catch (SQLException e) {
E.printStackTrace ()
}
}
/ * *
* destroy a custom connection pool
, /
For (Connection conn: activeConnection) {
Try {
If (isValid (conn)) {
Conn.close ()
}
} catch (SQLException e) {
E.printStackTrace ()
}
}
IsActive = false
ContActive = 0
}
/ * *
* connection pool status
*
* @ return
, /
Public boolean isActive () {
Return isActive
}
/ * *
* check the connection pool regularly
, /
Public void cheackPool () {
If (dbBean.isCheakPool ()) {
If (LOG.isInfoEnabled ()) {
LOG.info ("Open the connection pool timing check task. The current set check frequency is" + dbBean.getPeriodCheck () + "and the check interval is" + dbBean.getLazyCheck ()). "
}
/ / start a timer-like clock task to detect the current thread in use
New Timer () .schedule (new TimerTask () {
@ Override
Public void run () {
/ / 1. Check the connection status in the thread
/ / 2. Minimum and maximum number of connections in connection pool
/ / 3. Check other states, because there are several thread-managed classes that need to be written here, which will not be added for the time being
If (LOG.isInfoEnabled ()) {
LOG.info ("empty line pool connections:" + freeConnection.size ())
LOG.info ("active connections::" + activeConnection.size ())
LOG.info ("Total connections:" + contActive)
}
}
}, dbBean.getLazyCheck (), dbBean.getPeriodCheck ()
}
}
}
/ * * ConnectionPoolManager*/
/ *
* Copyright 2000-2020 YGSoft.Inc All Rights Reserved.
, /
Package com.ygsoft.gris.mapp.materialmanage.impl.util
Import java.sql.Connection
Import java.sql.SQLException
Import java.util.Hashtable
Import com.ygsoft.ecp.service.log.EcpLogFactory
Import com.ygsoft.ecp.service.log.IEcpLog
/ * *
* connection pool management.
*
* @ author mapengfei
* @ version 1.0.0 May 12, 2016
* @ see
* @ since JDK 1.5.0
, /
Public class ConnectionPoolManager {
/ * *
* connection pool storage
, /
Public Hashtable pools = new Hashtable ()
/ * *
* Log
, /
Private static final IEcpLog LOG = EcpLogFactory.getLog (ConnectionPoolManager.class)
/ * *
* Constructor
, /
Private ConnectionPoolManager () {
Init ()
}
/ * *
* singleton implementation
*
* @ return
, /
Public static ConnectionPoolManager getInstance () {
Return Singtonle.INSTANCE; / / start singleton mode
}
/ * *
*
* enable singleton
*
* @ author mapengfei
* @ version 1.0.0 May 12, 2016
* @ see
* @ since JDK 1.5.0
, /
Private static class Singtonle {
Private static ConnectionPoolManager INSTANCE = new ConnectionPoolManager ()
}
/ * *
* initialize all connection pooling
, /
Public void init () {
/ * *
* put connection pooling into management
, /
For (int I = 0; I
< DBInitInfo.beans.size(); i++) { DBbean bean = DBInitInfo.beans.get(i); ConnectionPool pool = new ConnectionPool(bean); if (pool != null) { pools.put(bean.getPoolName(), pool); // 写入集合 if (LOG.isInfoEnabled()) { LOG.info("信息:初始化连接池成功 ->"+ bean.getPoolName ())
}
}
}
}
/ * *
* obtain the connection according to the name of the connection pool
*
* @ param poolName
* connection pool name
* @ return
, /
Public Connection getConnection (final String poolName) {
Connection conn = null
If (pools.size () > 0 & & pools.containsKey (poolName)) {
Conn = getPool (poolName). GetConnection ()
} else {
If (LOG.isInfoEnabled ()) {
LOG.info ("Error: the link was not found->" + poolName)
}
}
Return conn
}
/ * *
* close and recycle the connection
*
* @ param poolName
* connection pool name
* @ param conn
* Link
, /
Public void closeConnection (final String poolName, final Connection conn) {
If (LOG.isInfoEnabled ()) {
LOG.info ("start the link off recycling mechanism to close the link for the connection pool named" + poolName+ "+ conn)
}
ConnectionPool pool = getPool (poolName)
Try {
If (pool! = null) {
Pool.releaseConn (conn)
}
} catch (SQLException e) {
If (LOG.isInfoEnabled ()) {
LOG.info ("connection pool destroyed")
}
E.printStackTrace ()
}
}
/ * *
* clear the connection pool
*
* @ param poolName
* connection pool name
, /
Public void destroy (final String poolName) {
ConnectionPool pool = getPool (poolName)
If (pool! = null) {
Pool.destroy ()
}
}
/ * *
* get connection pooling
*
* @ param poolName
* connection pool name
* @ return
, /
Public ConnectionPool getPool (final String poolName) {
ConnectionPool pool = null
If (pools.size () > 0) {
Pool = pools.get (poolName)
}
Return pool
}
}
/ * * DBbean*/
Package com.ygsoft.gris.mapp.materialmanage.impl.util
/ * *
* this is an externally configurable connection pool property
* external configuration can be allowed, with default values
* @ author Ran
*
, /
Public class DBbean {
/ / connection Pool Properties
Private String driverName
Private String url
Private String userName
Private String password
Name of the private String poolName; / / link pool
Private int minConnections = 1; / / Free pool, minimum number of connections
Private int maxConnections = 10; / / Free pool, maximum number of connections
Private int initConnections = 5 handle / number of initialized connections
Private long connTimeOut = 1000 / frequency of repeated acquisition of connection
Private int maxActiveConnections = 10 / maximum number of connections allowed, corresponding to the database
Private long connectionTimeOut = 1000minutes 60ram / connection timeout. Default is 1 minute.
Private boolean isCurrentConnection = true; / / whether to obtain the current connection, default true
Private boolean isCheakPool = true; / / whether to check the connection pool regularly
Private long lazyCheck = 1000 minutes 60 ram / how long after the delay to start the check
Private long periodCheck = 10000060ram / check frequency
/ * *
*
* @ param driverName driver name
* @ param url
* @ param userName
* @ param password
* @ param poolName connection pool name
, /
Public DBbean (final String driverName, final String url, final String userName,final String password, final String poolName) {
Super ()
This.driverName = driverName
This.url = url
This.userName = userName
This.password = password
This.poolName = poolName
}
Public DBbean () {
}
Public String getDriverName () {
If (driverName = = null) {
DriverName = this.getDriverName () + "_" + this.getUrl ()
}
Return driverName
}
/ * *
* get url.
* @ return the url
, /
Public String getUrl () {
Return url
}
/ * *
* set url.
* @ param newUrl the url to set
, /
Public void setUrl (final String newUrl) {
Url = newUrl
}
/ * *
* get userName.
* @ return the userName
, /
Public String getUserName () {
Return userName
}
/ * *
* set userName.
* @ param newUserName the userName to set
, /
Public void setUserName (final String newUserName) {
UserName = newUserName
}
/ * *
* get password.
* @ return the password
, /
Public String getPassword () {
Return password
}
/ * *
* set password.
* @ param newPassword the password to set
, /
Public void setPassword (final String newPassword) {
Password = newPassword
}
/ * *
* get poolName.
* @ return the poolName
, /
Public String getPoolName () {
Return poolName
}
/ * *
* set poolName.
* @ param newPoolName the poolName to set
, /
Public void setPoolName (final String newPoolName) {
PoolName = newPoolName
}
/ * *
* get minConnections.
* @ return the minConnections
, /
Public int getMinConnections () {
Return minConnections
}
/ * *
* set minConnections.
* @ param newMinConnections the minConnections to set
, /
Public void setMinConnections (final int newMinConnections) {
MinConnections = newMinConnections
}
/ * *
* get maxConnections.
* @ return the maxConnections
, /
Public int getMaxConnections () {
Return maxConnections
}
/ * *
* set maxConnections.
* @ param newMaxConnections the maxConnections to set
, /
Public void setMaxConnections (final int newMaxConnections) {
MaxConnections = newMaxConnections
}
/ * *
* get initConnections.
* @ return the initConnections
, /
Public int getInitConnections () {
Return initConnections
}
/ * *
* set initConnections.
* @ param newInitConnections the initConnections to set
, /
Public void setInitConnections (final int newInitConnections) {
InitConnections = newInitConnections
}
/ * *
* get connTimeOut.
* @ return the connTimeOut
, /
Public long getConnTimeOut () {
Return connTimeOut
}
/ * *
* set connTimeOut.
* @ param newConnTimeOut the connTimeOut to set
, /
Public void setConnTimeOut (final long newConnTimeOut) {
ConnTimeOut = newConnTimeOut
}
/ * *
* get maxActiveConnections.
* @ return the maxActiveConnections
, /
Public int getMaxActiveConnections () {
Return maxActiveConnections
}
/ * *
* set maxActiveConnections.
* @ param newMaxActiveConnections the maxActiveConnections to set
, /
Public void setMaxActiveConnections (final int newMaxActiveConnections) {
MaxActiveConnections = newMaxActiveConnections
}
/ * *
* get connectionTimeOut.
* @ return the connectionTimeOut
, /
Public long getConnectionTimeOut () {
Return connectionTimeOut
}
/ * *
* set connectionTimeOut.
* @ param newConnectionTimeOut the connectionTimeOut to set
, /
Public void setConnectionTimeOut (final long newConnectionTimeOut) {
ConnectionTimeOut = newConnectionTimeOut
}
/ * *
* get isCurrentConnection.
* @ return the isCurrentConnection
, /
Public boolean isCurrentConnection () {
Return isCurrentConnection
}
/ * *
* set isCurrentConnection.
* @ param newIsCurrentConnection the isCurrentConnection to set
, /
Public void setCurrentConnection (final boolean newIsCurrentConnection) {
IsCurrentConnection = newIsCurrentConnection
}
/ * *
* get isCheakPool.
* @ return the isCheakPool
, /
Public boolean isCheakPool () {
Return isCheakPool
}
/ * *
* set isCheakPool.
* @ param newIsCheakPool the isCheakPool to set
, /
Public void setCheakPool (final boolean newIsCheakPool) {
IsCheakPool = newIsCheakPool
}
/ * *
* get lazyCheck.
* @ return the lazyCheck
, /
Public long getLazyCheck () {
Return lazyCheck
}
/ * *
* set lazyCheck.
* @ param newLazyCheck the lazyCheck to set
, /
Public void setLazyCheck (final long newLazyCheck) {
LazyCheck = newLazyCheck
}
/ * *
* get periodCheck.
* @ return the periodCheck
, /
Public long getPeriodCheck () {
Return periodCheck
}
/ * *
* set periodCheck.
* @ param newPeriodCheck the periodCheck to set
, /
Public void setPeriodCheck (final long newPeriodCheck) {
PeriodCheck = newPeriodCheck
}
/ * *
* set driverName.
* @ param newDriverName the driverName to set
, /
Public void setDriverName (final String newDriverName) {
DriverName = newDriverName
}
}
/ * DBInitInfo*/
/ *
* Copyright 2000-2020 YGSoft.Inc All Rights Reserved.
, /
Package com.ygsoft.gris.mapp.materialmanage.impl.util
Import java.util.ArrayList
Import java.util.List
Import com.ygsoft.gris.mapp.materialmanage.impl.ext.config.BaseConfig
/ * *
* initialize and simulate loading all configuration files.
* @ author mapengfei
* @ version 1.0.0 May 12, 2016
* @ see
* @ since JDK 1.5.0
, /
Public class DBInitInfo {
Public static List beans = null
Static {
Beans = new ArrayList ()
/ / the data can be obtained from configuration files such as xml.
/ / for the test, I will write directly to death here.
DBbean beanOracle = new DBbean ()
BeanOracle.setDriverName (BaseConfig.get ("DriverName"))
BeanOracle.setUrl (BaseConfig.get ("JdbcUrl"))
BeanOracle.setMinConnections (Integer.valueOf (BaseConfig.get ("MinConnections")
BeanOracle.setMaxConnections (Integer.valueOf (BaseConfig.get ("MaxConnections")
BeanOracle.setPoolName (BaseConfig.get ("PoolName"))
BeanOracle.setUserName (BaseConfig.get ("dbusername"))
BeanOracle.setPassword (BaseConfig.get ("dbpassword"))
Beans.add (beanOracle)
}
}