Hi!

I'm using derby 10.2.2.0 in a standalone Java application. I perform
some queries in concurrent threads over derby DB, in a transactional
environment, using JOTM. In conditions of high load of queries, I get
some of these SQL Exceptions:

- SQL Exception: ResultSet not open. Operation 'next' not permitted.
Verify that autocommit is OFF.
- SQL Exception: 'Statement' already closed.

when I try to obtain the result of some "SELECT" queries. The code is like this:

       ....
       PreparedStatement ps = null;
       ResultSet rs = null;
       try {
           ps = connection.prepareStatement("SELECT xml_data FROM
tablename WHERE name = ?");
           int i = 1;
           ps.setString(i++, name);
           rs = ps.executeQuery();
           if (rs.next()) {
               InputStream inputStream = rs.getBinaryStream(1);
               resultObject = object_storage.load(inputStream);
           } else {
               throw new StorageInternalException("Object not found.");
           }
           return resultObject;

       } catch (SQLException e) {
       ...
       }

I get the errors executing the "next()" method on the ResultSet. If
there is no transaction when I execute the query, the error never
happens.

Which could be the problem?

Thanks.

Reply via email to