db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius.Stroffek" <Julius.Strof...@Sun.COM>
Subject Re: openConnection dissapeared from BaseJDBCTestCase.java
Date Mon, 13 Nov 2006 15:25:08 GMT
Just posting the corresponding test function:
---

    public void testMultipleConnections() throws Exception {
        Connection conn1 = openConnection("FIRSTDB1");
        conn1.setAutoCommit(false);
        Statement st = conn1.createStatement();
        st.execute("create table FIRSTDB_T1 (i int, j int, k int)");
        st.execute("insert into FIRSTDB_T1 values (1, 3, 5)");
        PreparedStatement pSt1 =
                conn1.prepareStatement("select * from FIRSTDB_T1");
        ResultSet rs1 = pSt1.executeQuery();
        rs1.next();
        rs1.close();
       
        Connection conn2 = openConnection("SECONDDB2");
        conn2.setAutoCommit(false);
        Statement st2 = conn2.createStatement();
        st2.execute("create table SECONDDB_T1 (i int, j int, k int)");
        st2.execute("insert into SECONDDB_T1 values (2, 4, 6)");
        PreparedStatement pSt2 =
                conn2.prepareStatement("select * from SECONDDB_T1");
       
        rs1 = pSt2.executeQuery();
        rs1.next();
        rs1.close();
       
        conn1.rollback();
        conn1.close();
        conn2.rollback();
        conn2.close();
    }
 
Julius.Stroffek wrote:
> Hi All,
>
> I prepared a patch for DERBY-1434 with a test. I wanted to submit it 
> today, however when updated a trunk to the most recent version, the 
> method
>
> openConnection(String databaseName)
>
> disaperead from the BaseJDBCTestCase.java.
>
> I need to create two connections to different databases in a test so 
> the openDefaultConnection() method is notsufficient. I think that 
> probably no tests used this method. How should I create these 
> connections today? Should I create the missing openConnection method?
>
> Cheers
>
> Julo


Mime
View raw message