log.info("testUsePreparedStatementAcrossTransactions");
if (log != null) log.info("testUsePreparedStatementAcrossTransactions");
    public void testUsePreparedStatementAcrossTransactions() throws Exception {                log.info("testUsePreparedStatementAcrossTransactions");        FBManagedConnectionFactory mcf = initMcf();        DataSource ds = (DataSource)mcf.createConnectionFactory();        FBConnection c = (FBConnection)ds.getConnection();        Statement s = c.createStatement();        LocalTransaction t = c.getLocalTransaction();        Exception ex = null;        t.begin();        try {            s.execute("DROP TABLE T1");        }        catch (Exception e) {        }        t.commit();        t.begin();        try {            s.execute("CREATE TABLE T1 ( C1 INTEGER not null primary key, C2 SMALLINT, C3 DECIMAL(18,0), C4 FLOAT, C5 DOUBLE PRECISION, C6 CHAR(10), C7 VARCHAR(20))");            //s.close();        }        catch (Exception e) {            ex = e;        }        t.commit();        t.begin();        PreparedStatement p = c.prepareStatement("insert into T1 values (?, ?, ?, ?, ?, ?, ?)");        p.setInt(1, 1);        p.setShort(2, (short)1);        p.setLong(3, 1);        p.setFloat(4, (float)1.0);        p.setDouble(5, 1.0);        p.setString(6, "one");        p.setString(7, "one");        assertTrue("execute returned true for insert statement", !p.execute());        p.setInt(1, 2);        p.setShort(2, (short)2);        p.setLong(3, 2);        p.setFloat(4, (float)2.0);        p.setDouble(5, 2.0);        p.setString(6, "two");        p.setString(7, "two");        assertTrue("executeUpdate count != 1", p.executeUpdate() == 1);        p.close();        p = c.prepareStatement("select * from T1 where C1 = ?");        p.setInt(1, 1);        ResultSet rs = p.executeQuery();        while (rs.next()) {            log.info("C1: " + rs.getInt(1)                + " C2: " + rs.getShort(2)                + " C3: " + rs.getLong(3)                + " C4: " + rs.getFloat(4)                + " C5: " + rs.getDouble(5)                + " C6: " + rs.getString(6)                + " C7: " + rs.getString(7)                );            log.info("C1: " + rs.getInt("C1")                + " C2: " + rs.getShort("C2")                + " C3: " + rs.getLong("C3")                + " C4: " + rs.getFloat("C4")                + " C5: " + rs.getDouble("C5")                + " C6: " + rs.getString("C6")                + " C7: " + rs.getString("C7")                );        }//        rs.close(); //should be automatic        t.commit();        //does prepared statemen persist across transactions?        t.begin();        p.setInt(1, 2);        rs = p.executeQuery();        while (rs.next()) {            log.info("C1: " + rs.getInt(1)                + " C2: " + rs.getShort(2)                + " C3: " + rs.getLong(3)                + " C4: " + rs.getFloat(4)                + " C5: " + rs.getDouble(5)                + " C6: " + rs.getString(6)                + " C7: " + rs.getString(7)                );            log.info("C1: " + rs.getInt("C1")                + " C2: " + rs.getShort("C2")                + " C3: " + rs.getLong("C3")                + " C4: " + rs.getFloat("C4")                + " C5: " + rs.getDouble("C5")                + " C6: " + rs.getString("C6")                + " C7: " + rs.getString("C7")                );        }        p.close();        t.commit();        t.begin();        s.execute("DROP TABLE T1");        s.close();        t.commit();        c.close();        if (ex != null) {            throw ex;        }    }