iBatis 框架在版本 2 和 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!!
发布评论
评论(2)
假设您已经设置了 JNDI 数据库资源,则 iBatis 3 配置 XML 文件的以下环境适合我(在 Tomcat 上运行):
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):
这是我的配置文件中的内容,在 Glassfish 和 WebSphere 中运行良好:
“jdbc/cpswebmon”是我的应用程序服务器上的 JNDI 资源名称
This is what I have in my config file, works well in Glassfish and WebSphere:
"jdbc/cpswebmon" is the JNDI resource name on my application server