This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

batch files in JDBC

 
sitaram irrinki
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can we run the batch files in jdbc and how many types of batchfiles.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35976
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sitaram,
Do you mean operating system batch files or batches of SQL statements? For OS batch files, take a look at Runtime.exec(). Not sure what the connection is to JDBC there. For batches of SQL statements, there is an executeBatch() method.
 
Kash Mhai
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally the usage is

PreparedStatement pSt = conn.prepareStatement(sbQuery.toString());

while (...) //Some loop
{
pSt.setString(1,...); //as many as needed by you
...
...
pSt.addBatch();
}

pSt.executeBatch();

Have fun
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!