# Need help with Gatling JDBC feeder

**URL:** <https://community.gatling.io/t/need-help-with-gatling-jdbc-feeder/3750>\
**Category:** Gatling (Open-Source)\
**Created:** [June 5, 2017, 5:56am UTC](https://community.gatling.io/t/need-help-with-gatling-jdbc-feeder/3750 "2017-06-05T05:56:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavithra\_Madurangi](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@Pavithra\_Madurangi](https://community.gatling.io/u/Pavithra_Madurangi)\
**Post date:** [June 5, 2017, 5:56am UTC](https://community.gatling.io/t/need-help-with-gatling-jdbc-feeder/3750/1 "2017-06-05T05:56:16Z")

</div>

I need to read few parameters from DB and what I did was similar to what is done in ‘Initialising parameters with jdbc feeder’ thread.

E.g : Create a simulation

import io.gatling.core.Predef.\_  
import io.gatling.http.Predef.\_  
import io.gatling.jdbc.Predef.\_  
import scala.concurrent.duration.\_  
import Headers.\_  
import OracleDataFeeder.\_

class BasicSimulation extends Simulation {

val urlHost = System.getProperty(“URL\_HOST”)  
val nbUsers:Int = java.lang.Integer.getInteger(“users”, 1)  
val myRamp:Long = java.lang.Long.getLong(“ramp”, 0L)

val httpProtocol = http  
.baseURL(urlHost)  
.acceptHeader("_/_")  
.acceptEncodingHeader(“gzip,deflate,sdch”)  
.acceptLanguageHeader(“en-US,en;q=0.8”)  
.connection(“keep-alive”)  
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36”)

val scn = scenario(“JDBC feeder sample”)  
.feed(jdbcFileFeeder)  
.exec(http(“Authentication”)  
.post("""/authenticator""")  
.headers(headers\_1)  
.header(“userName”, “${userName}”)  
.header(“password”,"${userPassword}")  
.header(“Origin”, “urlHost”)  
.check(jsonPath("$.token").saveAs(“tokenId”))  
.check(status.is(200)))

setUp(scn.inject(rampUsers(nbUsers) over (myRamp seconds)).protocols(httpProtocol))

}

Then create a separate class for OracleDataFeeder

`

object OracleDataFeeder {

Class.forName(“oracle.jdbc.driver.OracleDriver”)  
val dbStatement = System.getProperty(“dbStatement”, “####################”)  
val jdbcFileFeeder = jdbcFeeder(“jdbc:oracle:thin:@host\_name:1521:service\_name”, “######”, “########”, dbStatement)  
}

`

I’m using [Gatling Plugin for Gradle]([http://Gatling](http://Gatling) Plugin for Gradle) and when I run the simulation, I get following error.

`

:compileGatlingJava UP-TO-DATE  
:compileGatlingScala UP-TO-DATE  
:processGatlingResources  
:gatlingClasses  
:gatlingRun  
Exception in thread “main” java.lang.ExceptionInInitializerError  
at numbering.CheckExternalServicesStatusSimulation.(CheckExternalServicesStatusSimulation.scala:16)  
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)  
at java.lang.Class.newInstance(Class.java:442)  
at io.gatling.app.Gatling$.io$gatling$app$Gatling$$$anonfun$1(Gatling.scala:41)  
at io.gatling.app.Gatling$lambda$1.apply(Gatling.scala:41)  
at io.gatling.app.Gatling$lambda$1.apply(Gatling.scala:41)  
at io.gatling.app.Gatling.run(Gatling.scala:92)  
at io.gatling.app.Gatling.runIfNecessary(Gatling.scala:75)  
at io.gatling.app.Gatling.start(Gatling.scala:65)  
at io.gatling.app.Gatling$.start(Gatling.scala:57)  
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:49)  
at io.gatling.app.Gatling$.main(Gatling.scala:43)  
at io.gatling.app.Gatling.main(Gatling.scala)  
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver  
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)  
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)  
at java.lang.Class.forName0(Native Method)  
at java.lang.Class.forName(Class.java:264)  
at numbering.OracleDataFeeder$.(OracleDataFeeder.scala:13)  
at numbering.OracleDataFeeder$.(OracleDataFeeder.scala)  
… 16 more  
:gatlingRun FAILED

`

I tried

- Adding ojdbc6.jar to build path

- Adding the driver to build.gradle

- `

- Putting it in my local Maven repository and referring to it using its coordinates

`

```auto
buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }
    dependencies {
        classpath 'com.oracle:ojdbc6:11.2.0.4'
        // Instead of
        // files ('lib/ojdbc6.jar')
    }
}

```

`

But nothing helped.

---

<div class="post-metadata">

**Author:** ![Yid\_End](https://avatars.discourse-cdn.com/v4/letter/y/e9c0ed/32.png) [@Yid\_End](https://community.gatling.io/u/Yid_End)\
**Post date:** [June 14, 2017, 8:59pm UTC](https://community.gatling.io/t/need-help-with-gatling-jdbc-feeder/3750/2 "2017-06-14T20:59:34Z")

</div>

looking at this - [http://gatling.io/docs/current/session/feeder/](http://gatling.io/docs/current/session/feeder/)  
it says, “Only JDBC4 drivers are supported, so that they automatically registers to the DriverManager.”

what i did was i modified this [https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm](https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm) to return an array of map of strings and use it as a feeder.

i hope this helps.
