Tomcat里使用JNDI设置Derby数据源

来源:互联网 发布:菜鸟不会数据分析 编辑:程序博客网 时间:2024/05/16 05:28

1. 在tomcat的tomcatx.x/conf/Catalina/localhost目录下找到你的sample(webapp名字).xml

 

2. 在这个xml文件中添加下面的代码

<?xml version="1.0" encoding="UTF-8"?>
<Context>
  <Resource
    name="jdbc/sampleDS"
    type="javax.sql.DataSource"
    auth="Container"
    password=""
    driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    maxIdle="2"
    maxWait="5000"
    username=""
    url="jdbc:derby:../Databases/sampleDB"
    maxActive="4"/>
   
  <!--  disable session persistence across Tomcat restarts  -->
  <Manager pathname="" />
</Context>

原创粉丝点击