dscsp.setDatabaseName("wombat");
//dscsp.setConnectionAttributes("unicode=true");
dsp = dscsp;
}
PooledConnection pc = dsp.getPooledConnection();
con1 = pc.getConnection();
con1.setAutoCommit(false);
Statement s = con1.createStatement();
System.out.println(" In the first connection handle to the pooled connection, create physical session schema, create table t1 in it");
System.out.println(" Insert some rows in physical SESSION.t1 table. Inspect the data.");
s.executeUpdate("CREATE schema SESSION");
s.executeUpdate("CREATE TABLE SESSION.t1(c21 int)");
s.executeUpdate("insert into SESSION.t1 values(11)");
s.executeUpdate("insert into SESSION.t1 values(12)");
s.executeUpdate("insert into SESSION.t1 values(13)");
ResultSet rs1 = s.executeQuery("select * from SESSION.t1"); //should return 3 rows for the physical table
dumpRS(rs1);
System.out.println(" Next declare a temp table with same name as physical table in SESSION schema.");
System.out.println(" Insert some rows in temporary table SESSION.t1. Inspect the data");
s.executeUpdate("declare global temporary table SESSION.t1(c11 int, c12 int) on commit preserve rows not logged");
s.executeUpdate("insert into SESSION.t1 values(11,1)");
rs1 = s.executeQuery("select * from SESSION.t1"); //should return 1 row for the temporary table
dumpRS(rs1);
System.out.println(" Now close the connection handle to the pooled connection");
con1.commit();
con1.close();
con1=null;
System.out.println(" Do another getConnection() to get a new connection handle to the pooled connection");
con2 = pc.getConnection();
s = con2.createStatement();
System.out.println(" In this new handle, a select * from SESSION.t1 should be looking at the physical session table");
rs1 = s.executeQuery("select * from SESSION.t1");
dumpRS(rs1);