header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
November 22, 2008, 10:04:23 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
datasink writing to mysql database problems
Welcome, Guest. Please login or register.
November 22, 2008, 10:04:23 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  datasink writing to mysql database problems
« previous next »
Pages: [1] Print
Author Topic: datasink writing to mysql database problems  (Read 686 times)
Marcel Brökel
Newbie
*
Posts: 9


« 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
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #1 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
Logged
Marcel Brökel
Newbie
*
Posts: 9


« Reply #2 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 ..  Huh  Undecided  Cry  Lips sealed
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #3 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
Logged
Marcel Brökel
Newbie
*
Posts: 9


« Reply #4 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
« Last Edit: June 19, 2008, 09:07:18 pm by Marcel Brökel » Logged
Marcel Brökel
Newbie
*
Posts: 9


« Reply #5 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
Logged
Ben Truitt
Newbie
*
Posts: 1


« Reply #6 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
Logged
Marcel Brökel
Newbie
*
Posts: 9


« Reply #7 on: June 26, 2008, 09:58:59 am »

i can't say anything about PostgreSQL, but for MySQL the new version works.
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header