These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: update made to be faster(performanec issue)
PostPosted: Tue Nov 07, 2006 5:14 am 
Newbie

Joined: Thu Oct 12, 2006 12:50 am
Posts: 3
Hi,
I have a problem regarding performance.
I am updateing 100 records using pst.addBatch(); command.
But it takes 5sec but i need within 2sec.
I am using PreparedStatement.
please reply me how I can improve method.

code is like this

String sql = "update bb_phh_recom set approval_dt= getDate() where phh_recom_id = ? and approval_dt is null ";
pst = conn.prepareStatement(sql);
Integer phhRecomId = null;
int rowsAffected[] = null;
int statusCount = 0;
int listLength = phhRecomIdList.size();

for (int count = 0; count < listLength; count++)
{

phhRecomId = (Integer) phhRecomIdList.get(count);
pst.setInt(1, phhRecomId.intValue());
pst.addBatch();
}
rowsAffected = pst.executeBatch();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.