Hello
I am using :

conn = ddf.getConnection();
        setConn(conn);
        ps = (PreparedStatement) conn.prepareStatement(
                ModelUtils.getXMLResource("selectAdmin"),ResultSet.TYPE_SCROLL_INSENSITIVE,
                ResultSet.CONCUR_READ_ONLY);
        ps.setString(1, thisUser);
        rs = ps.executeQuery();

and

public int getRowCount() {
            try {
                rs.last();
                return rs.getRow();
            } catch (SQLException ex) {
                Logger.getLogger(AdminPanel.class.getName()).log(Level.SEVERE, null, ex);
                ex.printStackTrace();
                return 0;
            }

        }

and it is giving the error

java.sql.SQLException: The 'last()' method is only allowed on scroll cursors.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)

Did I set the ps wrong?
thanks

I set up the CORRECT ps as the code said. that was a different ps
no more error

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.