private void testCache() throws Exception {
  deleteDb("fileLockSerialized");
  String urlShared="jdbc:h2:" + getBaseDir() + "/fileLockSerialized;FILE_LOCK=SERIALIZED";
  Connection connShared1=getConnection(urlShared);
  Statement statement1=connShared1.createStatement();
  Connection connShared2=getConnection(urlShared);
  Statement statement2=connShared2.createStatement();
  statement1.execute("create table test1(id int)");
  statement1.execute("insert into test1 values(1)");
  ResultSet rs=statement1.executeQuery("select id from test1");
  rs.close();
  rs=statement2.executeQuery("select id from test1");
  rs.close();
  statement1.execute("update test1 set id=2");
  Thread.sleep(500);
  rs=statement2.executeQuery("select id from test1");
  assertTrue(rs.next());
  assertEquals(2,rs.getInt(1));
  rs.close();
  connShared1.close();
  connShared2.close();
  deleteDb("fileLockSerialized");
}

private void testCache ( ) throws Exception { deleteDb ( "fileLockSerialized" ) ; String urlShared = "jdbc:h2:" + getBaseDir ( ) + "/fileLockSerialized;FILE_LOCK=SERIALIZED" ; Connection connShared1 = getConnection ( urlShared ) ; Statement statement1 = connShared1 . createStatement ( ) ; Connection connShared2 = getConnection ( urlShared ) ; Statement statement2 = connShared2 . createStatement ( ) ; statement1 . execute ( "create table test1(id int)" ) ; statement1 . execute ( "insert into test1 values(1)" ) ; ResultSet rs = statement1 . executeQuery ( "select id from test1" ) ; rs . close ( ) ; rs = statement2 . executeQuery ( "select id from test1" ) ; rs . close ( ) ; statement1 . execute ( "update test1 set id=2" ) ; Thread . sleep ( 500 ) ; rs = statement2 . executeQuery ( "select id from test1" ) ; assertTrue ( rs . next ( ) ) ; assertEquals ( 2 , rs . getInt ( 1 ) ) ; rs . close ( ) ; connShared1 . close ( ) ; connShared2 . close ( ) ; deleteDb ( "fileLockSerialized" ) ; }
caches must be cleared . session . reconnect only closes the diskfile ( which is associated with the cache ) if there is one session
