iBatis 3

编程入门 行业动态 更新时间:2024-10-27 17:10:48
iBatis 3 - JNDI配置示例(iBatis 3 - JNDI configuration example)

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

本文发布于:2023-07-19 16:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1183591.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iBatis

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!