Reputation: 85
I have a problem trying to setup a JDBC connection in Jmeter. What I need to do is getting a username from a first database, called A, and use that username as a connection parameter in a second JDBC connection, so I can connect to database B.
I read that the JDBC connection is loaded immediately, before any JDBC request. So I cannot pass usernames as parameters to it. How could I achieve this?
I am using the latest version of Jmeter (5.4.1).
Upvotes: 0
Views: 820
Reputation: 168002
One of the options is getting the username in the setUp Thread Group, converting it into a JMeter Property using __setProperty() function and reading the username in the normal Thread Group using __P() function
Alternative approach would be switching from JDBC Request sampler to JSR223 Sampler and instantiate the connection (or connection pool) yourself. See Working with a relational database chapter of Groovy documentation for more details.
Upvotes: 1