You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Abram Catalano <ab...@adaptx.com> on 2008/01/09 21:56:28 UTC

multiple inserts with JDBC sampler

I have the need to setup some data in my DB to run tests against.  I'd 
prefer that my JMeter test plan do this. 

The problem I am having is that I need to insert 20-50 rows before I can 
start my tests, but I can only seem to insert one row at a time with the 
JDBC Sampler (as Oracle does not support "insert into foo (name,bla) 
values (aaa,bbb),(ccc,ddd),(eee,fff)")

Is there something I am missing?  can I have multiple SQL INSERT 
statements in one JDBC Sampler? 
How have other people solved this?

Thanks,
-Abram

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: multiple inserts with JDBC sampler

Posted by Abram Catalano <ab...@adaptx.com>.
Thanks for pointing this out.  Much appreciated.

-Abram


Shane Petroff wrote:
> Abram Catalano wrote:
>>
>> Is there something I am missing?  can I have multiple SQL INSERT 
>> statements in one JDBC Sampler? How have other people solved this? 
> I use a single JDBC sampler coupled with a CSV Data Set Config which 
> contains an arbitrary number of SQL statements (hundreds in my case). 
> Inside the config file, I also specify the query type so that I can 
> derive my CSV files directly from the database trace logs. In this 
> manner I am able to simulate the interaction of multiple applications 
> in one test plan. I have 2 thread groups, each representing an 
> application and each pulling SQL from a separate CSV file whose 
> contents is derived from a trace of the application I am trying to 
> simulate. The final piece of the puzzle is that I embed tokens within 
> the SQL and replace those at runtime to ensure that updates always 
> contain new data and inserts do not collide between runs. This forces 
> the db to write to disk the same way that real users' data would. 
> While it could be better, it hasn't been bad either. The main problem 
> I had was answered a few days back (thanks sebb) in the thread entitled:
>
> SQL and javascript replace
>
> Apparently quotes embedded in the SQL read from the CSV file are not 
> handled properly within the __javascript call when normal references 
> are used, so one has to use vars.get("variableName") to sidestep the 
> quote issue. It wasn't particularly easy to figure this all out, but 
> so far I haven't found the time to amend the documentation either...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: multiple inserts with JDBC sampler

Posted by Shane Petroff <sh...@mayet.ca>.
Abram Catalano wrote:
>
> Is there something I am missing?  can I have multiple SQL INSERT 
> statements in one JDBC Sampler? How have other people solved this? 
I use a single JDBC sampler coupled with a CSV Data Set Config which 
contains an arbitrary number of SQL statements (hundreds in my case). 
Inside the config file, I also specify the query type so that I can 
derive my CSV files directly from the database trace logs. In this 
manner I am able to simulate the interaction of multiple applications in 
one test plan. I have 2 thread groups, each representing an application 
and each pulling SQL from a separate CSV file whose contents is derived 
from a trace of the application I am trying to simulate. The final piece 
of the puzzle is that I embed tokens within the SQL and replace those at 
runtime to ensure that updates always contain new data and inserts do 
not collide between runs. This forces the db to write to disk the same 
way that real users' data would. While it could be better, it hasn't 
been bad either. The main problem I had was answered a few days back 
(thanks sebb) in the thread entitled:

 SQL and javascript replace

Apparently quotes embedded in the SQL read from the CSV file are not 
handled properly within the __javascript call when normal references are 
used, so one has to use vars.get("variableName") to sidestep the quote 
issue. It wasn't particularly easy to figure this all out, but so far I 
haven't found the time to amend the documentation either...

-- 
Shane


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: multiple inserts with JDBC sampler

Posted by "Wang, Harry" <Ha...@corp.aol.com>.
Hi Abram,

I would also like to do something like that in my WSAPI application
using Sybase ASE.

Could I contact you directly to discuss the implementation?

Harry 

-----Original Message-----
From: Abram Catalano [mailto:abram@adaptx.com] 
Sent: Wednesday, January 09, 2008 12:56 PM
To: JMeter Users List
Subject: multiple inserts with JDBC sampler

I have the need to setup some data in my DB to run tests against.  I'd
prefer that my JMeter test plan do this. 

The problem I am having is that I need to insert 20-50 rows before I can
start my tests, but I can only seem to insert one row at a time with the
JDBC Sampler (as Oracle does not support "insert into foo (name,bla)
values (aaa,bbb),(ccc,ddd),(eee,fff)")

Is there something I am missing?  can I have multiple SQL INSERT
statements in one JDBC Sampler? 
How have other people solved this?

Thanks,
-Abram

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org