aspose file tools
The moose likes JDBC and the fly likes strange!! if not close, database not show ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "strange!! if not close, database not show ??" Watch "strange!! if not close, database not show ??" New topic
Author

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

Dairmon Lee
Ranch Hand

Joined: Feb 25, 2002
Posts: 30
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

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Jul 09, 2001
Posts: 1879

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: strange!! if not close, database not show ??
 
Similar Threads
Exception while using JNDI resources
About good exception handling practices?
values not been inserted
JDBC Transactions across multiple databases
Error during CLOB update