Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem with Batch

 
Ranch Hand
Posts: 473
  • 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
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • 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: 473
  • 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 ]
 
Every plan is a little cooler if you have a blimp. And a tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic