Then it sounds like the problem is with datanucleus not closing it's connection to the db. Perhaps it needs some special call or parameter to tell it that? Or are you using db_close_delay in your db URL? Which would also cause the db to not close when the last connection is closed. Or maybe you are using a connection pool which may also need to be shut down.
On Saturday, 2 November 2013, marcolopes wrote: > Thomas, i know what's going on... > > 1) The first backup is made > 2) The database is opened (i'm using Datanucleus persistence, so, no > control from my code) > 3) A database LOCK file is created > 4) I close the "Persistence Manager Factory" but the LOCK file is not > released... (it is released only when i terminate the java app) > 5) Subsequent backups attempts cause org.h2.jdbc.JdbcSQLException: Cannot > change the setting "backup" when the database is already open [90133-169] > > On Saturday, November 2, 2013 9:14:22 AM UTC, Thomas Mueller wrote: >> >> Hi, >> >> I don't know what you do exactly, but I can not reproduce it. Could you >> provide a simple, reproducible test case? My test case is: I create a >> database "test". After that there is a file called "test.h2.db". Then I >> backup this file 4 times, and that works, and no .lock.db files are created. >> >> *public* *class* Test { >> >> *public* *static* *void* main(String... args) *throws* Exception { >> >> Backup.execute("~/temp/backup1.zip", "~/temp", "test", *true*); >> >> Backup.execute("~/temp/backup2.zip", "~/temp", "test", *false*); >> >> Backup.execute("~/temp/backup3.zip", "~/temp", "test", *true*); >> >> Backup.execute("~/temp/backup4.zip", "~/temp", "test", *false*); >> >> } >> >> } >> >> I would expect from you a similar test case then the one above. >> >> Regards, >> Thomas >> >> >> On Fri, Nov 1, 2013 at 7:14 PM, marcolopes <marco...@netc.pt> wrote: >> >>> The database is **closed**! >>> >>> The problem is that, on the first backup execution a LOCK is created... >>> and all subsequent backup attempts fail. >>> >>> >>> On Friday, November 1, 2013 5:52:55 PM UTC, Thomas Mueller wrote: >>> >>>> Hi, >>>> >>>> What do you try to do? If the database is open, you should probably use >>>> the BACKUP SQL statement, not the Backup standalone tool. >>>> >>>> Regards, >>>> Thomas >>>> >>>> >>>> >>>> On Fri, Nov 1, 2013 at 6:39 PM, marcolopes <marco...@netc.pt> wrote: >>>> >>>>> I don't really understand the behavior of this parameter on the >>>>> *Backup.execute* method. >>>>> >>>>> I thought it would disable the possible "log info", but, inspecting >>>>> the code, it goes beyond that. >>>>> >>>>> The problem with the current approach is: if quiet=false, there is an >>>>> attempt to LOCK the database... and the LOCK file remains until the JAVA >>>>> session is terminated... so, another subsequent attempt to BACKUP a **yet >>>>> closed** but now locked database, fails! >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "H2 Database" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to h2-database...@googlegroups.com. >>>>> To post to this group, send email to h2-da...@googlegroups.com. >>>>> >>>>> Visit this group at http://groups.google.com/group/h2-database. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "H2 Database" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to h2-database...@googlegroups.com. >>> To post to this group, send email to h2-da...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/h2-database. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to h2-database+unsubscr...@googlegroups.com <javascript:_e({}, > 'cvml', 'h2-database%2bunsubscr...@googlegroups.com');>. > To post to this group, send email to > h2-database@googlegroups.com<javascript:_e({}, 'cvml', > 'h2-database@googlegroups.com');> > . > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.