Hi Guys, this is my notes on connecting to SQL instance through JMeter. For this example I am using latest version of JMeter that is 4.0 and SQL server 2017. We also need the latest SQL JDBC driver jar, I have downloaded the JDBC Driver 6.0.
1.Open your JMeter instance and add a JDBC config element which helps for setting up the connection to sql server.
2.Now give all the details like DB connection pool name (which is important when using the JDBC sampler),
SQL server URL name, Driver Class ( I am using com.microsoft.sqlserver.jdbc.SQLServerDriver as I am using latest JDBC driver, if your are using JDBC driver less than 5.0 version then you must use the other one that is com.microsoft.jdbc.sqlserver.SQLServerDriver),Username and Password.
3.Now one thing is pending that we need to make sure that the JMeter is able to access the Microsoft JDBC driver so for this purpose we can include the jar file in TestPlan, where we have the option to browse and include that jar files.
4.Now the setup is done, it is time to add the JDBC request sampler along with the required query and donot forget the DB pool connection name which we assigned in JDBC configuration.
5.Finally add listener and run it.