• ibatis配置


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE sqlMapConfig      
        PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"      
        "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
    <sqlMapConfig>
    	<properties resource="sqlmap.properties" />
    	<settings cacheModelsEnabled="true" enhancementEnabled="true" lazyLoadingEnabled="true" maxRequests="32" maxSessions="10" maxTransactions="5"
    		useStatementNamespaces="true" />
    	<transactionManager type="JDBC">
    		<dataSource type="SIMPLE">
    			<property name="JDBC.Driver" value="${jdbc.driverClassName}" />
    			<property name="JDBC.ConnectionURL" value="${jdbc.url}" />
    			<property name="JDBC.Username" value="${jdbc.username}" />
    			<property name="JDBC.Password" value="${jdbc.password}" />
    			<property name="Pool.MaximumActiveConnections" value="10" />
    			<property name="Pool.MaximumIdleConnections" value="5" />
    			<property name="Pool.MaximumCheckoutTime" value="120000" />
    			<property name="Pool.TimeToWait" value="500" />
    			<property name="Pool.PingQuery" value="select 1 from sample" />
    			<property name="Pool.PingEnabled" value="false" />
    			<property name="Pool.PingConnectionsOlderThan" value="1" />
    			<property name="Pool.PingConnectionsNotUsedFor" value="1" />
    		</dataSource>
    	</transactionManager>
    	<sqlMap resource="byd/entity/xml/DpPo.xml" />
    	<sqlMap resource="byd/entity/xml/dpt.xml" />
    	<sqlMap resource="byd/entity/xml/Supplier.xml" />
    	<sqlMap resource="byd/entity/xml/Judge.xml" />
    	<sqlMap resource="byd/entity/xml/his.xml" />
    </sqlMapConfig>
    
     
    sqlmap.properties
    
    jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
    jdbc.url=jdbc\:oracle\:thin\:@10.6.78.244\:1521\:denali  
    jdbc.username=scmdp  
    jdbc.password=scmdp  
    
     
    package byd.core;
    
    import java.io.IOException;
    import java.io.Reader;
    
    import com.ibatis.common.resources.Resources;
    import com.ibatis.sqlmap.client.SqlMapClient;
    import com.ibatis.sqlmap.client.SqlMapClientBuilder;
    
    public class BaseDao {
    	private static SqlMapClient sqlMapper;
    	public static synchronized SqlMapClient getSqlmap() {
    		if (sqlMapper == null) {
    			try {
    				Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
    				sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
    				reader.close();
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
    		return sqlMapper;
    	}
    
    }
     
  • 相关阅读:
    setTimeOut 和 setInterval对比
    vue官方源码剖析
    Taro 总结
    地图相交
    vscode 配置文件
    redis持久化的几种方式
    推荐.Net、C# 逆向反编译四大工具利器
    【转】Java 通过JDBC连接Mysql数据库的方法和实例【图文说明】
    【摘】Oracle 11g EM安全证书问题无法访问的解决办法
    MySql 从SQL文件导入
  • 原文地址:https://www.cnblogs.com/qq1988627/p/6606927.html
Copyright © 2020-2023  润新知