• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dairmon Lee
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic