Eviware Forum

soapUI => soapUI => Topic started by: Marcel Brökel on June 12, 2008, 03:05:39 pm



Title: datasink writing to mysql database problems
Post by: Marcel Brökel on June 12, 2008, 03:05:39 pm
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


Title: Re: datasink writing to mysql database problems
Post by: omatzura on June 13, 2008, 10:33:54 am
Hi!

the JDBC DataSinks sql statement is treated as a prepared statement, where the properties are assigned in the order they are defined, ie try changing the sql to

Code:
INSERT into result_checkAddress (
      test_id,
      execution_id,
      input_data,
      output_data,
      test_result,
      test_comment
)
VALUES (
      ?,
      ?,
      ?,
      ?,
      if (STRCMP(
            'IFNULL(?,'')',
            '?}'
            ),
      'NOTOK', 'OK'
      ),
      'Comment'
)

And then see to it that you have 6 properties in your datasink; their values need to be set before the DataSink is executed (they can also contain property-expansions which will be expanded accordingly).

Hope this helps!

regards,

/Ole
eviware.com


Title: Re: datasink writing to mysql database problems
Post by: Marcel Brökel on June 19, 2008, 08:16:24 pm
Hi,

sorry but i tried it hardly again in much different way - complex or simple, the only way it works is the properties are static.

all properties are set and i use a very simple insert statement and althoug i got the error message above.


========================

insert into result_checkaddress (
      test_id,
      execution_id,
      input_data,
      output_data
      )
values (
      ?,
      ?,
      ?,
      ?
)

=========================

i have no more ideas ..  ???  :-\  :'(  :-X


Title: Re: datasink writing to mysql database problems
Post by: omatzura on June 19, 2008, 08:50:34 pm
Hi!

can you show me the definition of the result_checkaddress table so I can test this locally? Thanks in advance!

regards,

/ole
eviware.com


Title: Re: datasink writing to mysql database problems
Post by: Marcel Brökel on June 19, 2008, 09:04:32 pm
CREATE TABLE IF NOT EXISTS `result_checkaddress` (
  `RESULT_ID` int(10) unsigned NOT NULL auto_increment,
  `TEST_ID` mediumtext NOT NULL,
  `EXECUTION_ID` mediumtext NOT NULL,
  `INPUT_DATA` mediumtext NOT NULL,
  `OUTPUT_DATA` mediumtext NOT NULL,
  `TEST_RESULT` mediumtext,
  `TEST_COMMENT` mediumtext,
  PRIMARY KEY  (`RESULT_ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=333 ;


i use server version 5.0.51a
and mysql-connector-java-5.1.6-bin.jar


Title: Re: datasink writing to mysql database problems
Post by: Marcel Brökel on June 20, 2008, 02:31:12 pm
Hi Ole,

thank you very much for your quick help.
The new version works in the expected way !!

thank !
Marcel


Title: Re: datasink writing to mysql database problems
Post by: Ben Truitt on June 25, 2008, 06:59:14 pm
Hi There -
 We are also experiencing this problem with PostgreSQL and soapui-pro 2.0.2.  Can you please clarify what we need to do in order to correct the problem (i.e. should we upgrade to a new version of soapui-pro??)

Thanks,
Ben


Title: Re: datasink writing to mysql database problems
Post by: Marcel Brökel on June 26, 2008, 09:58:59 am
i can't say anything about PostgreSQL, but for MySQL the new version works.