You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Pham Anh Tuan <an...@ichi-corp.jp> on 2006/07/27 04:54:06 UTC
[HELP] 4 times connect to DB for each queryForPaginatedList() method ???
Hi all,
I don't know why everytime I use "sqlMap.queryForPaginatedList("getProductSearchResult2", constraints, num);", there're 4 times my web application connects to DB like below:
DEBUG [http-8080-Processor24] - Created connection 32717744.
DEBUG [http-8080-Processor24] - {conn-100150} Connection
DEBUG [http-8080-Processor24] - {pstm-100151} PreparedStatement: select productId, productTypeNo, name, viewedPic, userId, lang, activeStatus, productNo from product where LANG = ? and NAME LIKE ? group by productNo desc
DEBUG [http-8080-Processor24] - {pstm-100151} Parameters: [1, s]
DEBUG [http-8080-Processor24] - {pstm-100151} Types: [java.lang.Integer, java.lang.String]
DEBUG [http-8080-Processor24] - {rset-100152} ResultSet
DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
DEBUG [http-8080-Processor24] - {conn-100153} Connection
DEBUG [http-8080-Processor24] - {pstm-100154} PreparedStatement: select productId, productTypeNo, name, viewedPic, userId, lang, activeStatus, productNo from product where LANG = ? and NAME LIKE ? group by productNo desc
DEBUG [http-8080-Processor24] - {pstm-100154} Parameters: [1, s]
DEBUG [http-8080-Processor24] - {pstm-100154} Types: [java.lang.Integer, java.lang.String]
DEBUG [http-8080-Processor24] - {rset-100155} ResultSet
DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
DEBUG [http-8080-Processor24] - {conn-100156} Connection
DEBUG [http-8080-Processor24] - {pstm-100157} PreparedStatement: select productId, productTypeNo, name, viewedPic, userId, lang, activeStatus, productNo from product where LANG = ? and NAME LIKE ? group by productNo desc
DEBUG [http-8080-Processor24] - {pstm-100157} Parameters: [1, s]
DEBUG [http-8080-Processor24] - {pstm-100157} Types: [java.lang.Integer, java.lang.String]
DEBUG [http-8080-Processor24] - {rset-100158} ResultSet
DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
DEBUG [http-8080-Processor24] - {conn-100159} Connection
DEBUG [http-8080-Processor24] - {pstm-100160} PreparedStatement: select productId, productTypeNo, name, viewedPic, userId, lang, activeStatus, productNo from product where LANG = ? and NAME LIKE ? group by productNo desc
DEBUG [http-8080-Processor24] - {pstm-100160} Parameters: [1, s]
DEBUG [http-8080-Processor24] - {pstm-100160} Types: [java.lang.Integer, java.lang.String]
DEBUG [http-8080-Processor24] - {rset-100161} ResultSet
DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
I don't understand, please help me :|
thanks in advance
bowlkhin
Re: [HELP] 4 times connect to DB for each queryForPaginatedList() method ???
Posted by Clinton Begin <cl...@gmail.com>.
I believe paginated list loads 4 pages to start. It's not designed for
efficiency....it's designed for simplicity.
I don't recommend using it if you're worried about performance. Instead,
use queryForList() and pass in the records to skip and how many to load.
Your application shouldn't store anything other than two integers: the
current page and the page size.
Clinton
On 7/26/06, Pham Anh Tuan <an...@ichi-corp.jp> wrote:
>
> Hi all,
>
> I don't know why everytime I use "sqlMap.queryForPaginatedList("getProductSearchResult2",
> constraints, num);", there're 4 times my web application connects to DB like
> below:
>
> DEBUG [http-8080-Processor24] - Created connection 32717744.
> DEBUG [http-8080-Processor24] - {conn-100150} Connection
> DEBUG [http-8080-Processor24] - {pstm-100151} PreparedStatement: select
> productId, productTypeNo, name, viewedPic, userId, lang, activeStatus,
> productNo from product where LANG = ? and NAME LIKE
> ? group by productNo desc
> DEBUG [http-8080-Processor24] - {pstm-100151} Parameters: [1, s]
> DEBUG [http-8080-Processor24] - {pstm-100151} Types: [java.lang.Integer,
> java.lang.String]
> DEBUG [http-8080-Processor24] - {rset-100152} ResultSet
> DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
> ******
> DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
> DEBUG [http-8080-Processor24] - {conn-100153} Connection
> DEBUG [http-8080-Processor24] - {pstm-100154} PreparedStatement: select
> productId, productTypeNo, name, viewedPic, userId, lang, activeStatus,
> productNo from product where LANG = ? and NAME LIKE
> ? group by productNo desc
> DEBUG [http-8080-Processor24] - {pstm-100154} Parameters: [1, s]
> DEBUG [http-8080-Processor24] - {pstm-100154} Types: [java.lang.Integer,
> java.lang.String]
> DEBUG [http-8080-Processor24] - {rset-100155} ResultSet
> DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
>
> DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
> DEBUG [http-8080-Processor24] - {conn-100156} Connection
> DEBUG [http-8080-Processor24] - {pstm-100157} PreparedStatement: select
> productId, productTypeNo, name, viewedPic, userId, lang, activeStatus,
> productNo from product where LANG = ? and NAME LIKE
> ? group by productNo desc
> DEBUG [http-8080-Processor24] - {pstm-100157} Parameters: [1, s]
> DEBUG [http-8080-Processor24] - {pstm-100157} Types: [java.lang.Integer,
> java.lang.String]
> DEBUG [http-8080-Processor24] - {rset-100158} ResultSet
> DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
>
> DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
> DEBUG [http-8080-Processor24] - {conn-100159} Connection
> DEBUG [http-8080-Processor24] - {pstm-100160} PreparedStatement: select
> productId, productTypeNo, name, viewedPic, userId, lang, activeStatus,
> productNo from product where LANG = ? and NAME LIKE
> ? group by productNo desc
> DEBUG [http-8080-Processor24] - {pstm-100160} Parameters: [1, s]
> DEBUG [http-8080-Processor24] - {pstm-100160} Types: [java.lang.Integer,
> java.lang.String]
> DEBUG [http-8080-Processor24] - {rset-100161} ResultSet
> DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
> DEBUG [http-8080-Processor24] - Checked out connection 32717744 from pool.
> DEBUG [http-8080-Processor24] - Returned connection 32717744 to pool.
> I don't understand, please help me :|
>
> thanks in advance
>
> bowlkhin
>