# Dynamic value into  JDBC feeder

**URL:** <https://community.gatling.io/t/dynamic-value-into-jdbc-feeder/3812>\
**Category:** Gatling (Open-Source)\
**Created:** [July 6, 2017, 2:49pm UTC](https://community.gatling.io/t/dynamic-value-into-jdbc-feeder/3812 "2017-07-06T14:49:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gopi\_Krish](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@Gopi\_Krish](https://community.gatling.io/u/Gopi_Krish)\
**Post date:** [July 6, 2017, 2:49pm UTC](https://community.gatling.io/t/dynamic-value-into-jdbc-feeder/3812/1 "2017-07-06T14:49:00Z")

</div>

Hi Guys,

i’m creating random username to create a customer using a createUser api.

Now i need to login this customer with an **otp**.

im trying to fetch that **otp** from DataBase. i’m able to fetch the otp using below SQL only if the user name is **hardcoded.**

val feederdb = jdbcFeeder(“jdbc:mysql://xx.x.169.xxx/usfdbuser”, “username”, “pwd”, “select otp from customer\_otp\_history where id in (select max(id) from customer\_otp\_history where bu\_id=42 and email\_id=‘**[loaduser123@yopmail.com](mailto:loaduser123@yopmail.com)**’ group by email\_id)”)

i need to be able to fetch the otp for every customer registered and should pass his email into the JDBC feeder every time Dynamically.

right now im using this,

val feederdb = jdbcFeeder(“jdbc:mysql://xx.x.169.xxx/usfdbuser”, “username”, “pwd”, “select otp from customer\_otp\_history where id in (select max(id) from customer\_otp\_history where bu\_id=42 and email\_id=’ **${userName}** ’ group by email\_id)”)

and getting the below exception

Exception in thread “main” java.lang.IllegalStateException: Feeder is now empty, stopping engine  
at io.gatling.core.action.SingletonFeed$$anonfun$receive$1.applyOrElse(SingletonFeed.scala:61)  
at akka.actor.Actor$class.aroundReceive(Actor.scala:484)  
at io.gatling.core.akka.BaseActor.aroundReceive(BaseActor.scala:23)  
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)  
at akka.actor.ActorCell.invoke(ActorCell.scala:495)  
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)  
at akka.dispatch.Mailbox.run(Mailbox.scala:224)  
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)  
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)  
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)  
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)  
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Guys, can you help me out with this
