如何使用 JDBC 请求在 JMeter 中设置存储过程的参数 [英] How to set up parameters of a stored procedure in JMeter using a JDBC Request

查看:29
本文介绍了如何使用 JDBC 请求在 JMeter 中设置存储过程的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用存储过程可调用语句加载数据库.我在 JMeter 中创建的测试计划如下所示:

I am planning to load the database using a stored procedure callable statement. The test plan I am creating in JMeter looks like below:

- Test plan
  - Thread Group
     - JDBC Connection Configuration
     - JDBC Request
     - View results tree
     - Summary Report

  • JDBC 连接配置 基于已经可用的测试.问题与我的 JDBC 请求有关:
  • 变量名:与JDBC连接配置中的数据库名相同
  • 查询类型:Callable Statement
  • 查询: {call schema.dbpk_utilities.get_user_id(?,?,?,?,?,?,?)}
  • 参数值: S12345, HR, OUT, NULL,NULL,NULL, NULL
  • 参数类型:VARCHAR、VARCHAR、INTEGER、VARCHAR、VARCHAR、VARCHAR、VARCHAR
  • 变量名:username,hr, id, 四、五、六、七
    • JDBC Connection Configuration is based on tests that already work. The question is with my JDBC Request:
    • Variable name: is the database name same as in JDBC Connection configuration
    • Query Type: Callable Statement
    • Query: {call schema.dbpk_utilities.get_user_id(?,?,?,?,?,?,?)}
    • Parameter values: S12345, HR, OUT, NULL,NULL,NULL, NULL
    • Parameter Types: VARCHAR, VARCHAR, INTEGER, VARCHAR, VARCHAR, VARCHAR, VARCHAR
    • Variable names: username,hr, id, four, five, six, seven
    • 我得到的错误是:

      Response message: java.lang.NumberFormatException: For input string:
      "OUT"
      

      谁能告诉我为什么回复消息?是否可以在 JMeter 中调用存储过程?我正在努力接受这个请求!

      Can anyone tell me why the response message? Is it possible to call Stored procedures in JMeter? I am struggling to OK this request!

      推荐答案

      按照上一篇文章中的无空格规则",我发现了为什么请求响应 java.lang.NumberFormatException: For input string: "OUT"信息.见下文

      Following the 'no space rule' from the previous post I found out why the request was responding with java.lang.NumberFormatException: For input string: "OUT" message. See below

      变量名:Oracle

      SQL 查询: 可调用语句

      查询: {call nsspishr.dbpk_user_utilities.get_user_details(?,?,?,?,?,?,?)}

      Query: {call nspishr.dbpk_user_utilities.get_user_details(?,?,?,?,?,?,?)}

      参数值: S12345,DMS,OUT,NULL,NULL,NULL,NULL

      Parameter Values: S12345,DMS,OUT,NULL,NULL,NULL,NULL

      Par 类型: VARCHAR,VARCHAR,OUT INTEGER,VARCHAR,VARCHAR,VARCHAR,VARCHAR

      Par Types: VARCHAR,VARCHAR,OUT INTEGER,VARCHAR,VARCHAR,VARCHAR,VARCHAR

      变量名:用户名、dms、id、四、五、六、七

      Variable names: username,dms,id,four,five,six,seven

      注意参数是如何在这个调用中注册的.在我的程序中,param 1 和 param 2 是 IN 参数.在我的例子中,通过给它们一个参数值 S12345 和 HR,这些是隐式的 IN 参数.

      Notice how the parameters are registered in this call. In my procedure param 1 and param 2 are IN parameters. These are made IN parameters implicitly by giving them a parameter value S12345 and HR in my case.

      从参数 3 到参数 7 都是 OUT 参数.参数 4、5、6 和 7 具有 NULL 值.因此无需将它们注册为 OUT 参数.但是,参数 3(id)是 OUT 参数,必须通过在 参数值 中明确说 OUT,然后在 参数类型 中说 OUT INTEGER 来注册它强>节.要记住的是,您需要在参数值和参数类型中指定 OUT.不要忘记参数类型字段中参数的数据类型.即 OUT INTEGER, OUT VARCHAR ...

      From param 3 all the way to param 7 are OUT parameters. Param 4, 5, 6 and 7 have NULL values. Therefore no need to register them as OUT parameters. Param 3 (the id), however, is the OUT parameter and it has to be registered as such by explicitly saying OUT in the parameter value and then saying OUT INTEGER in the parameter types section. The thing to remember is that you need to specify OUT in both parameter value and parameter type. Not to forget the datatype of the parameter in the parameter types field. ie OUT INTEGER, OUT VARCHAR ...

      希望能帮到你

      这篇关于如何使用 JDBC 请求在 JMeter 中设置存储过程的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆