2

I'm using JDBC connection configuration and JDBC request sampler to fetch test data from database for large set of data for my test requirement. My question is, if we connecting to database through connection configuration and JDBC sampler to fetch data from database then how we can close the connection from database like we are having other performance testing tool Neoload. As of now what i'm seeing from total number of active connections in sql server using sp_who2 or below query is that JDBC connection not closed after jmeter test execution completed. Question is, How to closed JDBC connection if my purpose to use is completed within the script execution? Any help would be appreciated.

  • Which version are you actually using? You can't be using three different versions at the same time? But in general: JMeter creates a connection pool and you can configure after how long an unused connection should be closed through the "Soft Min Evictable Idle Time" property. See the manual for details: https://jmeter.apache.org/usermanual/component_reference.html#JDBC_Connection_Configuration –  Oct 17 '19 at 09:22
  • Did you solve your issue? if not did you contact JMeter ? – Ori Marko Nov 05 '19 at 15:43

2 Answers2

0

There's an issue with JDBC Connection Configuration when using connection pooling

Maximum number of connections allowed in the pool. In most cases, set this to zero (0). This means that each thread will get its own pool with a single connection in it, i.e. the connections are not shared between threads.

If you set 0 connections and problem still persist, open an issue for JMeter

Community
  • 1
  • 1
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
0

If this is something you really need, you can invoke DataSourceElement.getConnection() function from any JSR223 Test Element which will return an instance of java.sql.Connection so you will be able to call Connection.close() function.

Something like:

org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection('foo').close()

where foo is your connection pool variable name.

enter image description here

Dmitri T
  • 159,985
  • 5
  • 83
  • 133