Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

performance

 
joew weakers
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a series of simple SQL insert statements that I need to execute based on values extracted from a for loop, is it quicker to use PreparedStatements or not. This is what my code looks like at present. Thnaks a lot, Joe.

...
Statement stmt = sc.conn.createStatement();
for(int f = 0; f < features.length; f++)
{
insert_query = "insert into joeweaker.interest_area_features values(\n"+
Welcome.userID+","+Welcome.sessionID+","+area_id+",'"+features[f]+"')";
stmt.execute(insert_query);
}
...
stmt.close();
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a thread discussing this
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic