db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mse...@dbrack01.segel.com
Subject Re: Two statement in while
Date Mon, 17 Dec 2007 20:03:56 GMT
That's rediculous. How do then do an outter/inner loops?

Sent via BlackBerry by AT&T

-----Original Message-----
From: "Brad Berens" <theg33k@gmail.com>

Date: Mon, 17 Dec 2007 14:57:10 
To:"Derby Discussion" <derby-user@db.apache.org>
Subject: Re: Two statement in while

Just a stab in the dark, but I think you can only have one resultset open in a connection
at a time.  I suggest using a connection pool and multiple connections.

On Dec 17, 2007 1:45 PM, Eduardo S.E. de Castro <estima@gmail.com <mailto:estima@gmail.com>
> wrote:

   I have a question about using two PreparedStatements in the same
connection. When I use the following line, I get an exception
java.sql.SQLException: ResultSet not open. Operation 'next' not
permitted. Verify that autocommit is OFF. 

        String strQuery = ...
        PreparedStatement pstmt = ...
        ResultSet rs = pstmt.executeQuery();

        while (rs.next()){
            Integer key = rs.getInt("LINE_ID"); 

            String strQuery2 = ...
            PreparedStatement pstmt2 = ...
            ResultSet rs2 = pstmt2.executeQuery();

            while (rs2.next()){

  I tried to set autoCommit to false, but it remains.


View raw message