变量存储 - Jmeter 中的 JDBC 请求
Variable Storage - JDBC request in Jmeter
我有以下问题:
添加JDBC请求时,查询类型为“Select语句”,我添加了一个变量名,但没有保存成功
有谁能说说原因吗?
在下方编码并在下方打印。
select 的脚本:
USE ${DATABASE};
Declare @ID_SOLICITACAO_RSP as int
Declare @NM_ARQUIVO_RET as varchar (50)
set @ID_SOLICITACAO_RSP =
(
SELECT
VLR_SEQUENCIA
FROM
TBJD_SEQUENCIA
WHERE
CD_NEGOCIO = 'JDCTC'
AND CD_OBJETO = 'IDSOLIC'
)
SET @NM_ARQUIVO_RET =
(
SELECT substring(cat.nm_arqv, len(cat.nm_arqv)-30, 31) + '_RET.XML'
FROM TBJDCTCPRO_SOLIC_ARQV_TRANS SAT
JOIN TBJDCTCCIP_ARQV_TRANS CAT ON (SAT.ID_ARQV_TRANS = CAT.ID_ARQV_TRANS)
JOIN TBJDCTCPRO_SOLIC SOL ON (SOL.ID_SOLICITACAO = SAT.ID_SOLICITACAO)
WHERE SAT.ID_SOLICITACAO = @ID_SOLICITACAO_RSP
AND CAT.TP_ARQV IN ('ACTC101', 'ACTC201', 'ACTC301', 'ACTC401', 'ACTC501', 'ACTC601', 'ACTC701', 'ACTC801', 'ACTC851')
)
PRINT @NM_ARQUIVO_RET;
enter image description here
你能帮帮我吗?
我们不能,因为在 JDBC 级别不可能执行调用 Statement.executeQuery() under the hood which doesn't produce a ResultSet.
的 Select 语句
因此您需要将查询转换为类似以下内容:
SELECT substring(cat.nm_arqv, len(cat.nm_arqv) - 30, 31) + '_RET.XML'
FROM TBJDCTCPRO_SOLIC_ARQV_TRANS SAT
JOIN TBJDCTCCIP_ARQV_TRANS CAT ON (SAT.ID_ARQV_TRANS = CAT.ID_ARQV_TRANS)
JOIN TBJDCTCPRO_SOLIC SOL ON (SOL.ID_SOLICITACAO = SAT.ID_SOLICITACAO)
WHERE SAT.ID_SOLICITACAO = (
SELECT VLR_SEQUENCIA
FROM TBJD_SEQUENCIA
WHERE CD_NEGOCIO = 'JDCTC'
AND CD_OBJETO = 'IDSOLIC'
)
AND CAT.TP_ARQV IN ('ACTC101', 'ACTC201', 'ACTC301', 'ACTC401', 'ACTC501', 'ACTC601', 'ACTC701', 'ACTC801', 'ACTC851')
所以它会发出单个 Select 语句,这会 return 结果。
更多信息:The Real Secret to Building a Database Test Plan With JMeter
我有以下问题:
添加JDBC请求时,查询类型为“Select语句”,我添加了一个变量名,但没有保存成功
有谁能说说原因吗?
在下方编码并在下方打印。
select 的脚本:
USE ${DATABASE};
Declare @ID_SOLICITACAO_RSP as int
Declare @NM_ARQUIVO_RET as varchar (50)
set @ID_SOLICITACAO_RSP =
(
SELECT
VLR_SEQUENCIA
FROM
TBJD_SEQUENCIA
WHERE
CD_NEGOCIO = 'JDCTC'
AND CD_OBJETO = 'IDSOLIC'
)
SET @NM_ARQUIVO_RET =
(
SELECT substring(cat.nm_arqv, len(cat.nm_arqv)-30, 31) + '_RET.XML'
FROM TBJDCTCPRO_SOLIC_ARQV_TRANS SAT
JOIN TBJDCTCCIP_ARQV_TRANS CAT ON (SAT.ID_ARQV_TRANS = CAT.ID_ARQV_TRANS)
JOIN TBJDCTCPRO_SOLIC SOL ON (SOL.ID_SOLICITACAO = SAT.ID_SOLICITACAO)
WHERE SAT.ID_SOLICITACAO = @ID_SOLICITACAO_RSP
AND CAT.TP_ARQV IN ('ACTC101', 'ACTC201', 'ACTC301', 'ACTC401', 'ACTC501', 'ACTC601', 'ACTC701', 'ACTC801', 'ACTC851')
)
PRINT @NM_ARQUIVO_RET;
enter image description here
你能帮帮我吗?
我们不能,因为在 JDBC 级别不可能执行调用 Statement.executeQuery() under the hood which doesn't produce a ResultSet.
的 Select 语句因此您需要将查询转换为类似以下内容:
SELECT substring(cat.nm_arqv, len(cat.nm_arqv) - 30, 31) + '_RET.XML'
FROM TBJDCTCPRO_SOLIC_ARQV_TRANS SAT
JOIN TBJDCTCCIP_ARQV_TRANS CAT ON (SAT.ID_ARQV_TRANS = CAT.ID_ARQV_TRANS)
JOIN TBJDCTCPRO_SOLIC SOL ON (SOL.ID_SOLICITACAO = SAT.ID_SOLICITACAO)
WHERE SAT.ID_SOLICITACAO = (
SELECT VLR_SEQUENCIA
FROM TBJD_SEQUENCIA
WHERE CD_NEGOCIO = 'JDCTC'
AND CD_OBJETO = 'IDSOLIC'
)
AND CAT.TP_ARQV IN ('ACTC101', 'ACTC201', 'ACTC301', 'ACTC401', 'ACTC501', 'ACTC601', 'ACTC701', 'ACTC801', 'ACTC851')
所以它会发出单个 Select 语句,这会 return 结果。
更多信息:The Real Secret to Building a Database Test Plan With JMeter