数据库连接池配置

来源:互联网 发布:ntfs for mac 14 编辑:程序博客网 时间:2024/06/09 21:49
<pre name="code" class="html"><span style="font-size:18px;">一、tomcat/server.xml<Context path="/xwebTest" docBase="D:\apache-tomcat-6.0.30\webapps\xwebTest"><Resource name="jndiSource"                        auth="Container"                        type="javax.sql.DataSource"                        driverClassName="oracle.jdbc.driver.OracleDriver"                        url="jdbc:oracle:thin:@59.44.47.154:1521:orcl"                        username="webadmin"                        password="begin110"                        maxActive="1"                        maxIdle="1"                        maxWait="10000"/><WatchedResource>WEB-INF/web.xml</WatchedResource></Context>二、web.xml<resource-ref><description>dbConn</description><res-ref-name>jndiSource</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth></resource-ref>三、hibernate.cfg.xml<?xml version="1.0" encoding="gb2312"?><!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration>    <session-factory name="default">       <property name="connection.datasource">java:/comp/env/jndiSource</property>        <property name="dialect">org.hibernate.dialect.Oracle9iDialect</property>        <property name="use_outer_join">true</property>        <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>        <property name="hibernate.query.factory_class ">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>        <property name="hibernate.connection.provider_class">org.hibernate.connection.DatasourceConnectionProvider</property>        <property name="show_sql">true</property>        <property name="hibernate.jdbc.fetch_size">50</property>        <property name="hibernate.jdbc.batch_size">20</property>        <property name="hibernate.query.substitutions">true 1, false 0</property><property name="hibernate.max_fetch_depth">5</property>       </session-factory></hibernate-configuration></span>


                                             
0 0
原创粉丝点击