复制代码 代码如下:
<Resource
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url=" jdbc:oracle:thin:@host:port:databse"
username=" user "
password="password"
maxActive="100"
maxIdle="30"
maxWait="10000" />
复制代码 代码如下:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/oracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
复制代码 代码如下:
<Resource
type="javax.sql.DataSource"
password="mypwd"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
maxIdle="2"
maxWait="5000"
validationQuery="select 1"
username="sa"
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb"
maxActive="4"/>
复制代码 代码如下:
<ResourceLink global="jdbc/mydb" type="javax.sql.DataSource"/>
复制代码 代码如下:
<Resource type="javax.sql.DataSource" password="mypwd" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" maxIdle="2" maxWait="5000" validationQuery="select 1" username="sa" url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb" maxActive="4"/>
复制代码 代码如下:
<Resource auth="Container" type="javax.sql.DataSource"/>
<ResourceParams>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
<parameter>
<name>password</name>
<value>test</value>
</parameter>
<!-- Class name for JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>net.sourceforge.jtds.jdbc.Driver</value>
</parameter>
<!-- Autocommit setting. This setting is required to make
Hibernate work. Or you can remove calls to commit(). -->
<parameter>
<name>defaultAutoCommit</name>
<value>true</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:jtds:sqlserver://url/filedb;charset=gb2312;autoReconnect=true</value>
</parameter>
<!-- Recover abandoned connections -->
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<!-- Set the number of seconds a dB connection has been idle
before it is considered abandoned.
-->
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<!-- Log a stack trace of the code which abandoned the dB
connection resources.
-->
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
新闻热点
疑难解答
图片精选