db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Rayl <er...@bellsouth.net>
Subject Rowset shortcomings
Date Sat, 04 Sep 2004 00:11:18 GMT
I'm working on some JDBC text that runs the same code on four different 
databases: Oracle, MySQL, HSQLDB, and Derby.  In my Rowset example, all 
databases behave correctly except Derby.  The code is shown below (I 
have omitted the DBUtil wrapper class to keep this message short).  If  
I omit the bind parameter and setInt(), it makes no difference.  The 
same version, implemented as a ResultSet, works fine.  The errors are:

 >JdbcRowSet (setTypeMap): Feature not implemented: no details.
which occurs on the statement: jrs.execute();

and the next error is:

 >SQL Exception when closing database resources
 >SQL State:   XJ012
 >Vendor code: 20000
 >Message:     'Connection' already closed.
which occurs when closing the connection.

I'm assuming that the problems are with Derby since this code runs on 
the other three databases without incident.  Any insights?  BTW, I've 
had not had a problem with a CachedRowSet test on Derby.

import java.sql.*;
import com.sun.rowset.*;
import oi.util.DBUtil;

public class DisplayEmployeesRs
    private static Connection conn;
    private static JdbcRowSetImpl jrs;
    private static String query = "select * from employee where salary < ?";

    public static void salariesRowSet()
            conn = DBUtil.getConnection();
            jrs = new JdbcRowSetImpl(conn);
            jrs.setInt(1, 20000);
            while (jrs.next())
                String first = jrs.getString("firstname");
                String last = jrs.getString("lastname");
                int salary = jrs.getInt("salary");
                System.out.println(first + " " + last + ": " + salary);
        // code omitted here

View raw message