Como usar o jmeter para testar um Oracle Stored Procedure com o tipo de retorno sys_refcursor?
Eu quero testar um Oracle Stored Procedure usando jmeter.Eu fiz tudo, mas os parâmetros.
E aqui está minha consulta SQL:
declarar outinfo varchar2 (20); outable sys_refcursor; begin {chamar RK_JSCX (?,?)}; fim;
O outtable no Oracle é um cursor.E eu usei resultSet para contê-lo em java.No entanto, o que eu definir em tipos de parâmetro, ele disse tipo inválido.
Sample Start: 2012-10-25 16:06:41 CST Tempo de carregamento: 0 Latência: 0 Tamanho em bytes: 25 Tamanho de cabeçalhos em bytes: 0 Tamanho do corpo em bytes: 25 Contagem de Amostras: 1 Contagem de Erros: 1 Código de resposta: null 0 Mensagem de resposta: java.sql.SQLException: Tipo de dados inválido: cursor
Cabeçalhos de resposta: oracle.jdbc.driver.T4CConnection@58ba09
Campos SampleResult: ContentType: text / plain DataEncoding: UTF-8
Como pode consertar isso? Obrigado!
Aqui está o meu código em 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);
}