You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Lukáš Šembera <se...@gmail.com> on 2014/04/08 17:11:47 UTC

JDBC sampler with multiple users

Hi,

I would like to test the database using JDBC with a certain amount of
distinct concurrent users (e.g. test_user_{1-100}).

I created a thread group with JDBC connection configuration where username
was defined as: "test_user_{$__threadNum}". Unfortunately this doesn't work
because __threadNum is not accessible in configuration elements (in other
words there is a single JDBC connection pool with N max connections for the
whole thread pool, whereas I probably need N JDBC connection pools with 1
max connections).

I was thiking about the Only Once Controller to define my resource pool
before actual queries are sent to the database, but I'm stuck again because
it is not possible to create JDBC connection configuration with username
such as test_user_{$someThreadScopedVariable}.

Any suggestions and hints are welcome.

Thank you.

Re: JDBC sampler with multiple users

Posted by Jeff Ohrstrom <jo...@hotmail.com>.
I'm sorry for the late reply, it is very possible that you've already
figured out a solution for this.  I would do this:

use a variable called 'currentThreadNum' and in a JSR223 Preprocessor do
something like this: Pass in the ${__ThreadNum} as args[0].
then do "vars.put("currentThreadNum",args[0]);"

Then you have test_user_${currentThreadNum} defined at runtime.  I hope
that helps, or at least may help the next person who encounters the same
thought.

On Tue, 2014-04-08 at 17:11 +0200, Lukáš Šembera wrote:
> Hi,
> 
> I would like to test the database using JDBC with a certain amount of
> distinct concurrent users (e.g. test_user_{1-100}).
> 
> I created a thread group with JDBC connection configuration where username
> was defined as: "test_user_{$__threadNum}". Unfortunately this doesn't work
> because __threadNum is not accessible in configuration elements (in other
> words there is a single JDBC connection pool with N max connections for the
> whole thread pool, whereas I probably need N JDBC connection pools with 1
> max connections).
> 
> I was thiking about the Only Once Controller to define my resource pool
> before actual queries are sent to the database, but I'm stuck again because
> it is not possible to create JDBC connection configuration with username
> such as test_user_{$someThreadScopedVariable}.
> 
> Any suggestions and hints are welcome.
> 
> Thank you.



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