I have an android app which use H2, and it's reliable. I only use these settings in my url ;FILE_LOCK=FS;PAGE_SIZE=1024;CACHE_SIZE=4096 (I set autocommit to false by code)
What i do is i manage H2 through an android Service. See android.app.Service.START_STICKY This way you have much more control over the lifecycle, and you can cleanly start/shutdown h2. It's also a lot less likely that you app's process will be killed at an innapropriate time. I assume you have a good reason to use h2 over sqlite. It's easier to use sqlite in the android world. On Friday, February 15, 2013 6:23:36 AM UTC-5, Bastian Schöpp wrote: > > Hi > > I am developing an Android app that uses the H2 database in embedded mode. > Since you can not handle close or kill requests to the app on Android the > database connection may be killed without notice. I noticed that changes to > the database are not persisted if the app gets killed. This is a big issue > for me on Android. Only if I close and reconnect the database changes are > persisted. > I use the following url to connect: > > jdbc:h2:/storage/emulated/0/MyApp/main;UNDO_LOG=0;LOG=0;LOCK_MODE=0;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=1;AUTO_RECONNECT=TRUE;AUTOCOMMIT=ON;COMPRESS_LOB=DEFLATE;WRITE_DELAY=0;ACCESS_MODE_DATA=rws;FILE_LOCK=FS;PAGE_SIZE=1024;CACHE_SIZE=8192;CIPHER=AES > > Any idea what causes the problem? > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
