¿Cómo usar jmeter para probar un procedimiento almacenado de Oracle con el tipo de retorno sys_refcursor?
Quiero probar un procedimiento almacenado de Oracle utilizando jmeter. He hecho todo menos parámetros.
Y aquí está mi consulta SQL:
declare outinfo varchar2 (20); outtable sys_refcursor; comience {llamar RK_JSCX (?,?)}; fin;
El ejecutable en Oracle es un cursor. Y utilicé resultSet para contenerlo en java. Sin embargo, independientemente de lo que establezca en los tipos de parámetros, dijo que el tipo no es válido.
Inicio de muestra: 2012-10-25 16:06:41 CST Tiempo de carga: 0 Latencia: 0 Tamaño en bytes: 25 Tamaño de encabezados en bytes: 0 Tamaño del cuerpo en bytes: 25 Recuento de muestras: 1 Recuento de errores: 1 Código de respuesta: nulo 0 Mensaje de respuesta: java.sql.SQLException: Tipo de datos no válido: cursor
Cabeceras de respuesta: oracle.jdbc.driver.T4CConnection@58ba09
Campos de SampleResult: ContentType: text / plain DataEncoding: UTF-8
¿Cómo se puede arreglar? ¡Gracias!
Aquí está mi código en java:
public String RK_JSCX() throws Exception {
RK_JSCX_Response response = null;
List<RK_JSCX_Outtable> list = null;
Connection con = null;
CallableStatement cs = null;
ResultSet rs = null;
String sql = null;
try {
sql = "{call RK_JSCX(?,?)}";
con = ConnectionUtils.getInstance().getConnect();
if (con.isClosed()) {
throw new IllegalStateException("ERROR.THE CONNECTION ISCLOSED");
}
cs = con.prepareCall(sql);
cs.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
rs = (ResultSet) cs.getObject(1);
list = new ArrayList<RK_JSCX_Outtable>();
while (rs.next()) {
RK_JSCX_Outtable out = new RK_JSCX_Outtable(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getInt(5), rs.getString(6));
list.add(out);
}
String outInfo = cs.getString(2);
response = new RK_JSCX_Response(list, outInfo);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if (rs != null) {
rs.close();
if (cs != null) {
cs.close();
}
if (con != null) {
con.close();
}
}
} catch (SQLException e) {
System.out.println("Exception2");
e.printStackTrace();
}
}
return JSON.toJSONString(response);
}