i got a problem when i'm closing an h2 connection(release database) and try to connect to another h2 database(debug database).
Snipplet to connect:
this.connection = new JdbcConnectionSource(connectionString);
Snipplet to disconnect:
this.connection.close();
ConnectionString:
jdbc:h2:file:/data/data/my.app/databases/myapp
jdbc:h2:file:/data/data/my.app/testdatabases/myapp
Then instead of using the "new" connection the old one is used. I'm using different directories for the databases. In both cases when i try to toggle between database1 and database2 the .lock and .trace files are not deleted in their directories.
I want exclude implmentation failures on my side. I'm using h2(current version) with ormlite on android 4.2.2.
Then instead of using the "new" connection the old one is used.
If you are creating a new ConnectionSource
then you will need to re-create all of your DAO classes and clear the DAO cache from within the DaoManager
. Each of the DAO classes has a copy of the old connection source that it uses.
ConnectionSource connectionSource = new JdbcConnectionSource(connectionString);
DaoManager.clearCache();
Dao<Foo,Integer> fooDao = DaoManager.createDao(connectionSource, Foo.class);
...