java - my server resultset is taking long time while looping through -
i facing performance issue sql server when trying connect using java application. sqljdbc4-4.0 driver version. looks latest available this.
the issue comes when use preparedstatemnt set paramerter option , when looping trough result set after specific number of iterations execution stops amost 5min , start iterating again. stopping occuring on fixed iterations.
this behavior occurs simple query below.
preparedstatemnt ps = null; resultset rs = null; ps = con.preparestatemnt("select id,name,phone table1 name = ?"); ps.setstring(1, "raj"); rs = ps.executequery(); // ok here int i=0; while(rs.next()){ // hangs here system.out.println(i++); } however, works fine if not set parameter , concatenate parameter query this,
preparedstatemnt ps = null; resultset rs = null; ps = con.preparestatemnt("select id,name,phone table1 name = 'bob' "); rs = ps.executequery(); // ok here int i=0; while(rs.next()){ // ok system.out.println(i++); } when use query no condition runs no hanging.
this tell me issue comes when use set parameter option . have tried use top rows see whether issue large number of rows. when set top 100. these 100 rows iterations stopped 2 times @ 28th iteration , 66th iterations. think on iteration hangs depends on size of number of columns.
can 1 me solve issue.
thanks in advance, syam.
you have more, many more, rajs bobs in database.
it has nothing whether use preparedstatement arguments or not.
Comments
Post a Comment