java中调用oracle中的分页程序出错?该怎么解决

java中调用oracle中的分页程序出错??
韩顺平的oracle视频中java调用分页程序代码:

import java.sql.*;


public class fenye {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","tiger");
CallableStatement cs=ct.prepareCall("{call fenye(?,?,?,?,?,?)}");
cs.setString(1,"emp");
cs.setInt(2,5);
cs.setInt(3,2);
cs.registerOutParameter(4,Types.INTEGER);
cs.registerOutParameter(5,oracle.jdbc.OracleTypes.INTEGER);
cs.registerOutParameter(6,oracle.jdbc.OracleTypes.CURSOR);
cs.execute();
int rowNow=cs.getInt(4);
int PageCount=cs.getInt(5);
ResultSet rs=(ResultSet)cs.getObject(6);
System.out.println("rowNow=:"+rowNow);
System.out.println("pagecount=:"+PageCount);
while(rs.next())
{
System.out.println("编号:"+rs.getInt(1));
}

catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}


bug:

java.sql.SQLException: Ref 游标无效
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
at oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:3211)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:5036)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4964)
at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:586)
at fenye.main(fenye.java:19)


求高手指正出错的原因??


------解决方案--------------------
单独执行存储过程能执行么?提示信息表明输出参数的游标是有问题的!