Marcel_Brökel
16 years agoOccasional Contributor
datasink writing to mysql database problems
Hi,
i tried to prepare some datadriven testsuits. To get the testdata i use an XAMMP with mysql database. Everything works, but writing back data to the database seens al litle bit 'mysterious'.
I tried two cases:
first i have set the update statement within the datasink step like this:
INSERT into result_checkAddress (
test_id,
execution_id,
input_data,
output_data,
test_result,
test_comment
)
VALUES (
'${Test Result Data#testId}',
'${Test Result Data#executionId}',
'${Test Result Data#inputData}',
'${Test Result Data#outputData}',
if (STRCMP(
'IFNULL(${Test Result Data#resultCode},'')',
'${Test Result Data#expectedResultCode}'
),
'NOTOK', 'OK'
),
'Comment'
)
'Test Result Data' is an Property step and the properties are moved to this step before.
== > there are written data into the database, but although two different datasets are used (and logged as processed in the different logs within the teststeps) only ONE dataset is written back to the database, but TWO times !!
I tried another way:
INSERT into result_checkAddress (
test_id,
execution_id,
input_data,
output_data,
test_result,
test_comment
)
VALUES (
'${result_checkaddress#testId}',
'${result_checkaddress#executionId}',
'${result_checkaddress#inputData}',
'${result_checkaddress#outputData}',
if (STRCMP(
IFNULL(${result_checkaddress#resultCode},''),
'${result_checkaddress#expectedResultCode}'
),
'NOTOK', 'OK'
),
'Comment'
)
'result_checkaddress' is the datasink step itself and the properties are moved to this before.
==> I've tried everything i mentioned, but every time i got the error message 'java.sql.SQLException: Parameter out of range (0 1).'
As i guess, it could mean the types does not match, or the number of parameters is not correct. But for me it seems everything schould be ok.
I have no more ideas where the fault is hidden, maybe someone has any idea how to solve my problem ?
Greets and thanks a lot ..
Marcel
i tried to prepare some datadriven testsuits. To get the testdata i use an XAMMP with mysql database. Everything works, but writing back data to the database seens al litle bit 'mysterious'.
I tried two cases:
first i have set the update statement within the datasink step like this:
INSERT into result_checkAddress (
test_id,
execution_id,
input_data,
output_data,
test_result,
test_comment
)
VALUES (
'${Test Result Data#testId}',
'${Test Result Data#executionId}',
'${Test Result Data#inputData}',
'${Test Result Data#outputData}',
if (STRCMP(
'IFNULL(${Test Result Data#resultCode},'')',
'${Test Result Data#expectedResultCode}'
),
'NOTOK', 'OK'
),
'Comment'
)
'Test Result Data' is an Property step and the properties are moved to this step before.
== > there are written data into the database, but although two different datasets are used (and logged as processed in the different logs within the teststeps) only ONE dataset is written back to the database, but TWO times !!
I tried another way:
INSERT into result_checkAddress (
test_id,
execution_id,
input_data,
output_data,
test_result,
test_comment
)
VALUES (
'${result_checkaddress#testId}',
'${result_checkaddress#executionId}',
'${result_checkaddress#inputData}',
'${result_checkaddress#outputData}',
if (STRCMP(
IFNULL(${result_checkaddress#resultCode},''),
'${result_checkaddress#expectedResultCode}'
),
'NOTOK', 'OK'
),
'Comment'
)
'result_checkaddress' is the datasink step itself and the properties are moved to this before.
==> I've tried everything i mentioned, but every time i got the error message 'java.sql.SQLException: Parameter out of range (0 1).'
As i guess, it could mean the types does not match, or the number of parameters is not correct. But for me it seems everything schould be ok.
I have no more ideas where the fault is hidden, maybe someone has any idea how to solve my problem ?
Greets and thanks a lot ..
Marcel