Topic: 请问ibatis中如何显示的关闭conection

  Print this page

1.请问ibatis中如何显示的关闭conection Copy to clipboard
Posted by: tesge
Posted on: 2004-12-08 00:51

如题,谢谢

2.Re:请问ibatis中如何显示的关闭conection [Re: tesge] Copy to clipboard
Posted by: floater
Posted on: 2004-12-08 02:43

I am not aware of this. In fact, I would be surprised if there is one.

The closest thing may be the session open/close, but that's still one level above. Yes, you have to close session if you open it.

3.Re:请问ibatis中如何显示的关闭conection [Re: tesge] Copy to clipboard
Posted by: tesge
Posted on: 2004-12-08 22:22

你的意思是如下代码
try {
SqlMapSession session = sqlMap.openSession()
session.startTransaction()
Employee emp2 = new Employee();
Integer generatedKey = (Integer) session.insert ("insertEmployee", emp2);
emp2.setFavouriteColour ("green");
session.update("updateEmployee", emp2);
session.commitTransaction();
} finally {
try {
session.endTransaction();
} finally {
session.close();
}

当调用了session.close()的话,connection会自动关闭或则还回到datasource中?


4.Re:请问ibatis中如何显示的关闭conection [Re: tesge] Copy to clipboard
Posted by: tesge
Posted on: 2004-12-08 23:07

假如我们的datasource中有20个连接,但是我们都等待ibatis去关闭用完后的connection,很可能会出现连接泄露的问题,所以,我希望在完成一个事务后能调用其提供的方法去立刻关闭当前的connection


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923