Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Batch

 
Maki Jav
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using Statement and it's addBatch() and executeBatch(); Database is Ms Access. I am using addBatch() twice before executing it.
The sql queries are:
st.addBatch("Insert into table1 (ProjID,developer) values ('"+prjid+"','"+dev+"')");
st.addBatch("Insert into table2 (ProjID,dated) values ('"+prjid+"',#"+date+"#)");
where prjid and dev are string variables and date is sql date.
The tables has a relationship table1 -one-----many- table2 between ProjIDs.
Now the problem is that while the executing is giving no problem and the int [] array returned has 1,1 values ie it is effecting both tables records
but though the data is saved in the table1 and not in the table2....why?
point: using :
st.executeUpdate("("Insert into table1 (ProjID,developer) values ('"+prjid+"','"+dev+"')");
st.executeUpdate("("Insert into table1 (ProjID,dated) values ('"+prjid+"','"+date+"')");
I am getting results!
Please help?
Maki Jav
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34084
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maki,

Is it safe to assume this is a typo? It should be table 2, not table 1.
If so, what error are you getting that tells you the data is not added?
 
Maki Jav
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
Everything is working fine! I was actually not closing connection earlier so I was getting data stored in table1 only and not in table2.
Now that I am closing the connecton after executeBatch(), I get the data saved in both of them.
I want to know what other free and professional level databases are available?
I have come across FireBird which is free and open source version of interbase6 (borland). It is homed at http://firebird.sourceforge.net
I have not used it as yet. Any ideas? Anyone?
Maki Jav
[ January 13, 2004: Message edited by: Maki Jav ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic