iBatis框架在版本2和版本3之间进行了大量调整,甚至配置文件(现在通常称为MapperConfig.xml)也是如此。
话虽如此,网上有很多关于如何使用iBatis创建JDBC连接池的例子,但我找不到一个关于如何使用JNDI的例子。 有一个更新的用户指南: http : //svn.apache.org/repos/asf/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.pdf ,它指的是第19页上的JNDI设置,但我仍然无法正确地与数据库进行通信。
非常感谢iBatis 3中JDNI(容器管理连接池)的工作示例!
The iBatis framework has been significantly tweaked between versions 2 & 3, so much that even the config file (now often referred to as MapperConfig.xml) is different.
That being said, there are lots of examples online on how to create a JDBC connection pool with iBatis, but I couldn't find one example on how to do it with JNDI. There is an updated user guide at: http://svn.apache.org/repos/asf/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.pdf which does refer to the JNDI settings on page 19, but I still couldn't it get it correctly communicate with the database.
A working example of a JDNI (container managed connection pool) in iBatis 3 would be greatly appreciated!!
最满意答案
假设您已经设置了JNDI数据库资源,iBatis 3配置XML文件的以下环境适用于我(在Tomcat上运行):
<environment id="development"> <transactionManager type="JDBC"/> <dataSource type="JNDI"> <property name="data_source" value="java:comp/env/jdbc/webDb"/> </dataSource> </environment>Assuming you've already got a JNDI database resource set up, the following environment for iBatis 3's configuration XML file works for me (running on Tomcat):
<environment id="development"> <transactionManager type="JDBC"/> <dataSource type="JNDI"> <property name="data_source" value="java:comp/env/jdbc/webDb"/> </dataSource> </environment>更多推荐
iBatis,JNDI,进行,MapperConfig,xml,电脑培训,计算机培训,IT培训"/> <meta name=&qu
发布评论