How to use aliases in jdbcFeader ?

Hi,

I am using a jdbcFeeder like that:

val scenarioFeeder = jdbcFeeder("jdbc:mysql://localhost/mydb", "user", "pass", "SELECT id as scenario_id FROMscenario` WHERE name = “” + scenarioName + “”").queue
val user = scenario(“user”).feed(scenarioFeeder)

`

But the result is named “id” instead of the expected “scenario_id”. What is wrong here?

As a workaround, I try to convert the name and display the content of the session to check if “scenario_id” has been set, but something is wrong:

`
.exec { session =>
session.set(“scenario_id”, session(“id”))
println(session)
session
}

`

Output:

`
Session(user,955446644765537536-0,Map(id → 4),1413879892893,0,OK,List(),)

`

So what if I want to use 2 feeders that returns both an id? Is there an easy way to rename the “id”?

Thanks for your help!

Ok, I fount the way to convert my attribute in the session:

`
.exec { session =>
val newSession = session.set(“scenario_id”, session(“id”))
println(newSession)
newSession
}

`

from here: https://groups.google.com/forum/#!topic/gatling/jS7pi5mOSd0

I forgot to say that am using Gatling 2.0.0

Problem solved, but would be nice to be able to use aliases in queries.

Fixed: https://github.com/gatling/gatling/issues/2329

Thanks for reporting!

Thanks for the quick fix!

My previous answer was wrong, the correct way to convert the name of the attribute in the session (until the patch is released) is

`

.exec { session =>
// convert “id” to “scenario_id”
val newSession = session.set(“scenario_id”, session(“id”).as[String])
newSession.remove(“id”)
}.exec { session =>
// print session
println(session)
session
}

`