Android sample using H2
I saw that you've done some tests on Android. When I am trying to run my test with H2, I am getting FileNotFoundException. I am trying to use use embedded mode and here is my code snippet:
String url = "jdbc:h2:~/myTestDB" + ";FILE_LOCK=FS" + ";PAGE_SIZE=1024"
+ ";CACHE_SIZE=8192";
Class.forName("org.h2.Driver");
return DriverManager.getConnection(url, "sa", "");
I have al开发者_StackOverflowso tried:
String url = "jdbc:h2:/data/data/" + "com.mydomain.MyApp"
+ "/data/myTestDB" + ";FILE_LOCK=FS" + ";PAGE_SIZE=1024"
+ ";CACHE_SIZE=8192";
but with no luck.
I've put myTest.h2.db in /assets folder of my Android project. If you can post your code sample that would be great!
Thanks
I don't know what the problem could be, could you post the complete error message and stack trace? The 'official' documentation is here:
http://h2database.com/html/tutorial.html#android
精彩评论