上善若水  

1):

  在tomcat的配置路径下的context.xml中添加如下代码:

  

<Resource name="jdbc/cmis"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="50"
maxWait="15000"
username="root"
password=""
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/mdym" />

2):

  在要引用JNDI的工程中的WEB-INF的web.xml中添加如下代码:

<resource-ref>
<res-ref-name>jdbc/cmis</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

3):

  在spring的hibernate的配置文件中添加如下代码:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/cmis</value>
</property>
</bean>

4):

commons-pool.jar

sqljdbc4.jar

两个.jar文件必须放在tomcat配置路径下的lib文件夹里

  

posted on 2012-10-19 20:32  sherryChang  阅读(199)  评论(0编辑  收藏  举报