• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

strange!! if not close, database not show ??

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I am using "sun.jdbc.odbc.JdbcOdbcDriver" doing a testing project using Access 2000 as the database.
I run into a strange scenario:
try{
con=DBUtil.getConnection();
Item it = new Item(con2);
// some insert statement here
con.commit(); //this line not work either!!
}catch (Exception e){
e.printStackTrace();
}finally{
try{
if (con2!=null){
con2.close();// if I comment out this line, database not show the change at all!!
}
}catch(Exception e){
e.printStackTrace();
}
}
Even if I add a con.commit() doesn't help, (if without the con.close() )
Is it normal? Any comments?
Thanks!
[ May 07, 2002: Message edited by: Dairmon Lee ]
[ May 07, 2002: Message edited by: Dairmon Lee ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, its a common problem. If you do a search of this forum, you'll find several probems refering to it like this one.
Options are to close the connection, or perform a dummy select afterwards, both seem to 'flush' the operations.
Dave
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also ( a side note ), I believe that Access does not support transactions, so con.commit() would be useless anyways. But this does sound like the problem David pointed out.
Jamie
 
reply
    Bookmark Topic Watch Topic
  • New Topic