db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Ramos Vazquez" <danielrv.l...@gmail.com>
Subject Problem with concurrent queries and transactions.
Date Mon, 07 May 2007 13:40:55 GMT

I'm using derby 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

Which could be the problem?


View raw message