• 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
Marshal
Posts: 35279
384
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic