English 中文(简体)
How to obtain an scroll_insensitive resultSet from a callableStatement in Java JDBC?
原标题:

I have a stored procedure in an Oracle 10g database, in my java code, i call it with:

CallableStatement cs = bdr.prepareCall("Begin ADMBAS01.pck_basilea_reportes.cargar_reporte(?,?,?,?,?); END;", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    cs.setInt(1, this.reportNumber);
    cs.registerOutParameter(2, OracleTypes.CURSOR);
    cs.registerOutParameter(3, OracleTypes.INTEGER);
    cs.registerOutParameter(4, OracleTypes.VARCHAR);
    cs.setDate(5, new java.sql.Date(this.fecha1.getTime()));
    cs.execute();

ResultSet rs = (ResultSet)cs.getObject(2);

i do obtain an ResultSet with correct records in it, but when i try an "scroll_insensitive - only" operation, (like absolute(1) ). I keep getting an SQLException stating that it doesn t work on FORWARD only resultSet.

So how can i obtain this ResultSet with scroll_insensitive capabilites?

Thanks in Advance.

问题回答

The result set type is merely a suggestion to the driver, which the driver can ignore or downgrade to FORWARD_ONLY if it can t comply. See here for details.





相关问题
MaxPooledStatements setting in JDBC oracle

I can t figure out how to set MaxPooledStatements in Oracle using the Oracle thin JDBC driver. Could someone point me in the right direction?

pass ResultSet from servlet to JSP

I am doing the following in my SampleServlet.java //Fill resultset from db .... try { ArrayList Rows = new ArrayList(); while (resultSet.next()){ ArrayList row = new ArrayList(); ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

Mysql session variable in JDBC string

am using this connection string to connect to mysql from java: jdbc:mysql://localhost:3306/db?noDatetimeStringSync=true&useUnicode=yes&characterEncoding=UTF-8 is it possible to set the ...

热门标签