I am trying to call the data from database and feed them for testing but I got this error “No suitable driver found for jdbc:sqlserver://(localdb)/MSSQLLocalDB/TestDB” . How do we configure jdbc driver for gatling? I download them and add in library (file → project structure → library and added the downloaded mssql-jdbc-7.4.1.jre112 file there) and below is my source code
package Simulations
import baseConfig.BaseSimulation
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.core.feeder.RecordSeqFeederBuilder
import io.gatling.core.structure.ScenarioBuilder
import io.gatling.http.protocol.HttpProtocolBuilder
import io.gatling.jdbc.Predef._
class TestFromDB extends BaseSimulation {
def retrieveBearerToken() = {
// retrieve authorization Bearer Token
}
private val dbConnectionString = "jdbc:sqlserver://(localdb)/MSSQLLocalDB/TestDB"
private val sqlQuery = "SELECT TOP (1000) [Col1] ,[Col2] ,[Col3] FROM [TestDB].[dbo].[Test]"
private val sqlUserName = ""
private val sqlPassword = ""
private val message = "${data}"
private val baseUrl = "base url"
private val requestCount = 1000
val sqlQueryFeeder: RecordSeqFeederBuilder[Any] = jdbcFeeder(dbConnectionString,
sqlUserName,
sqlPassword,
sqlQuery
)
val httpProtocols: HttpProtocolBuilder = http
.baseURL(baseUrl)
.inferHtmlResources()
.acceptHeader("*/*")
.userAgentHeader("curl/7.54.0")
val headers_0 = Map("Expect" -> "100-continue")
/*** Scenario Design ***/
val scn: ScenarioBuilder = scenario("Testing")
.feed(sqlQueryFeeder)
.exec(http("request_0")
.post("Login/start")
.headers(sessionHeaders)
.body(StringBody(message)).asJSON
.check(status.is(200)))
setUp(scn.inject(atOnceUsers(requestCount))).protocols(httpProtocols)
}