ilovejs / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

Create or replace view statement has no effect on the others already existing JDBC connection #517

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
MC_OPR is a view as "select * from MC_OPR_M" at beginning;

new Thread(new Runable(){
  Connection conn1 = datasource.getConnection();
  public void run(){
    for(;;){
      conn.createStatement().executeQuery("select * from MC_OPR");  // then return from MC_OPR_M
    }
  }
}).start();

new Thread(new Runable(){
  Connection conn2 = datasource.getConnection();
  char[] suffixs = new char[]{'S','M'};
  public void run(){
    for(int i=0;true;i++){
      conn.createStatement().execute("create or replace view MC_OPR as select * from MC_OPR_"+ suffixs[i%2]); 
      // after this statement, conn1 always get from MC_OPR_M
    }
  }
}).start();

Original issue reported on code.google.com by artern@gmail.com on 24 Oct 2013 at 2:32

GoogleCodeExporter commented 9 years ago
Fixed in revision 5269

Original comment by noelgrandin on 28 Oct 2013 at 7:43