This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
 
friki data migration
Ranch Hand
Posts: 772
  • Mark post as helpful
  • send pies
  • Report post to moderator
See the JdbcFaq for non-SQL specific JDBC questions. Or ask in the JDBC forum. Also see SqlBestPractices.

Q. How do I batch statements to reduce roundtrips?

For inserts/updates, it is easy - JDBC provides an executeBatch() method. For select statements, it requires a bit of engineering. Batching Select Statements has a good discussion on the topic

Q. How do I insert if the record doesn't exist and update if it does?

The SQL merge statement does this "or" operation. If the row exists, it does an update. Otherwise it inserts a row.
 
    Bookmark Topic Watch Topic
  • New Topic