JDBCFeeder setup question

Hi there,

Just wondering if anyone experienced issues setting up ojdbc.jar file for using oracle JDBC feeder?

I’m getting the following error when attempting to use JDBC feeder,

Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//xxxxxxxxxxxxxx
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at io.gatling.jdbc.feeder.JdbcFeederSource$.apply(JdbcFeederSource.scala:29

I’m currently using the maven plugin in my pom file and have the following dependency for ojdbc

com.oracle ojdbc14 10.2.0.3.0

I have added the jar into a local repository manually and the jar is present in the local repository that I can see.

Not sure why it is not picking up the jar? or is the jar not compatible? Or am I missing something obvious here?

Has anyone successfully used oracle JDBC feeder using maven plugin?
Any suggestions would be greatly appreciated.

Ta

Any help please?

JDBC drivers automatically register themselves against the DriverManager only since JDBC4.
You’re using a JDBC3 so you have to trigger the registration manually, which is done by convention by loading the driver class. Add a Class.forName("") in your simulation.

I’m trying to use jdbc feeder to connect to oracle db.

I have the following:

val oracleFeeder= jdbcFeeder("jdbc:oracle:thin:@//my_db_host:1521/scheme", "user", "pass","select name from USER")

val session = feed(oracleFeeder) .exec(http("/session") .post("/session") .body(ElFileBody("session.json"))

My maven pom has dependency:

`

com.oracle
ojdbc8
12.2.0.1

`

When I launch my script I get an error:

`

Exception in thread “main” java.lang.NullPointerException
at io.gatling.core.action.builder.FeedBuilder.newSingletonFeed(FeedBuilder.scala:38)
at io.gatling.core.action.builder.FeedBuilder.$anonfun$build$1(FeedBuilder.scala:43)
at scala.collection.mutable.HashMap.getOrElseUpdate(HashMap.scala:82)
at io.gatling.core.action.builder.FeedBuilder.build(FeedBuilder.scala:43)
at io.gatling.core.structure.StructureBuilder.$anonfun$build$1(StructureBuilder.scala:34)
at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:122)
at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:118)
at scala.collection.immutable.List.foldLeft(List.scala:86)
at io.gatling.core.structure.StructureBuilder.build(StructureBuilder.scala:33)
at io.gatling.core.structure.StructureBuilder.build$(StructureBuilder.scala:32)
at io.gatling.core.structure.ScenarioBuilder.build(ScenarioBuilder.scala:38)
at io.gatling.core.structure.PopulationBuilder.build(ScenarioBuilder.scala:98)
at io.gatling.core.scenario.SimulationParams.$anonfun$scenarios$1(Simulation.scala:188)
at scala.collection.immutable.List.map(List.scala:283)
at io.gatling.core.scenario.SimulationParams.scenarios(Simulation.scala:188)
at io.gatling.app.Runner.run0(Runner.scala:95)
at io.gatling.app.Runner.run(Runner.scala:64)
at io.gatling.app.Gatling$.start(Gatling.scala:63)
at io.gatling.app.Gatling$.fromMap(Gatling.scala:40)
at Engine$.delayedEndpoint$Engine$1(Engine.scala:12)
at Engine$delayedInit$body.apply(Engine.scala:4)
at scala.Function0.apply$mcV$sp(Function0.scala:34)
at scala.Function0.apply$mcV$sp$(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at Engine$.main(Engine.scala:4)
at Engine.main(Engine.scala)
`

Tell me please, what I’m doing wrong? Error is not informative for me.

My2cents: you’re instanciating oracleFeeder AFTER trying to pass this reference to feed.

Stephane, thank you, you are absolutely right! One more question - is this possible to use in a query a ${var} variable, from another feeder? Something like:
`

val oracleFeeder= jdbcFeeder(“jdbc:oracle:thin:@//my_db_host:1521/scheme”, “user”, “pass”,“select name from USER where SURNAME = ${SRNM}”)
`

This will make a query dynamic.

No

And is it possible at all, to customize a feeder query? I’ve tried to use a scala variable instead of gatling, but not succeed with it. Tell me please, should I try more, or there is no way to select data in a query according to some dynamic value?

I’ve found a suitable solution here - https://groups.google.com/forum/#!topic/gatling/STlb_ihkzIo

after adding Class.forName(“”) getting classNotFoundException

Class.forName(“THE_FQCN_OF_YOUR_JDBC3_DRIVER_HERE”) !