关闭

hibernate和ms-sql、tomcat连接池配置

501人阅读 评论(0) 收藏 举报

hibernate.cfg.xml

<?xml version='1.0' encoding='big5'?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "
http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

    <session-factory>

<!--
        <property name="show_sql">true</property>

        <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

        <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>

        <property name="connection.url">jdbc:jtds:sqlserver://localhost:1433/epsDB</property>

        <property name="connection.username">sa</property>

        <property name="connection.password">123456</property>
-->
<!--
        <property name="show_sql">true</property>

        <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

        <property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>

        <property name="connection.url">jdbc:mysql://127.0.0.1:3306/test</property>

        <property name="connection.username">root</property>

        <property name="connection.password"></property>

-->

        <property name="connection.datasource">java:comp/env/jdbc/epsDB</property>

        <property name="show_sql">true</property>

        <property name="use_outer_join">true</property>

        <property name="hibernate.dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

  <mapping resource="map/Users.hbm.xml" />

 </session-factory>

</hibernate-configuration>

============================================

Server.xml

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
            timestamp="true"/>

<Context path="/eps" debug="0" docBase="D:/eps/web" reloadable="true">
<Resource name="jdbc/epsDB" auth="Container" type="javax.sql.DataSource"/>    

       <ResourceParams name="jdbc/epsDB">

        <parameter>  
             <name>factory</name>  
             <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> 
        </parameter>

        <parameter> 
            <name>driverClassName</name>  
            <value>net.sourceforge.jtds.jdbc.Driver</value>  
        </parameter>

  <parameter>
             <name>url</name>  
             <value>jdbc:jtds:sqlserver://localhost:1433/epsDB</value>    
        </parameter>  

        <parameter>
               <name>username</name>
               <value>sa</value>
        </parameter>  

        <parameter>
           <name>password</name>  
           <value>123456</value>
        </parameter>  

        <parameter>
           <name>maxActive</name>
           <value>20</value>
        </parameter>

        <parameter>  
           <name>maxIdle</name>  
           <value>10</value>
        </parameter>

        <parameter>
           <name>maxWait</name>
           <value>-1</value>
        </parameter>        
 </ResourceParams>    

 </Context>
</Host> 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:143778次
    • 积分:1981
    • 等级:
    • 排名:千里之外
    • 原创:59篇
    • 转载:62篇
    • 译文:0篇
    • 评论:6条
    文章分类
    最新评论