zoukankan      html  css  js  c++  java
  • jmeter 连接SQLServer执行insert语句时, JDBC Request 报错:java.lang.NumberFormatException: For input string: ""解决方法

    具体报错:

    2020-06-30 16:59:04,466 ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'JDBC Request-insert'.

    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:1.8.0_251]
    at java.lang.Long.parseLong(Unknown Source) ~[?:1.8.0_251]
    at java.lang.Long.parseLong(Unknown Source) ~[?:1.8.0_251]
    at org.apache.jmeter.functions.Random.execute(Random.java:64) ~[ApacheJMeter_functions.jar:5.3]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:135) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:110) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.modifiers.UserParameters.setValues(UserParameters.java:156) ~[ApacheJMeter_components.jar:5.3]
    at org.apache.jmeter.modifiers.UserParameters.process(UserParameters.java:141) ~[ApacheJMeter_components.jar:5.3]
    at org.apache.jmeter.threads.JMeterThread.runPreProcessors(JMeterThread.java:950) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:549) ~[ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.3]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.3]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]

    解决方法:

    1.查看下insert sql语句中的每个字段值是否正确,我这里是因为参数化了,但是字段参数化有问题,所以导致报错;问题如下:

    2,查看下insert操作时,字段的类型是否正确,字段类型转换是否正确,否则也会报错,尤其注意date类型的参数化,时间戳比较容易出问题,

    可参考:jmeter的时间戳函数使用

    https://blog.csdn.net/jocleyn/article/details/83414433

    我这里后来改为了:${__time(yyyy-MM-dd HH:mm:ss:SSS,time)}  ,错误得以解决

  • 相关阅读:
    VI的常用命令【工具篇】
    linux中安装中文字体
    阅读源代码,学习PostgreSQL数据库 (1) 准备工作
    如何安装gcc 3.3.6
    Buffered I/O and nonbuffered I/O
    Linux下查看硬件配置的相关命令
    linux disk i/o shceduler
    Linux编译内核操作流程 ——为新手指南
    HDOJ 1026 Ignatius and the Princess I
    HDOJ 2544 最短路 SPFA算法
  • 原文地址:https://www.cnblogs.com/fppblog/p/13215256.html
Copyright © 2011-2022 走看看