How to generate CSV file using Gatling from database

Hi,

I want to generate CSV file using Gatling from database. Flow is like,

    1. Execute SQL statement using Feeder to fetch IDs
    1. Save those IDs into CSV file
    1. Fetch random 10 or specified number of Ids from csv and put those in REST API Request call

Here is database table of query "SELECT ID_ FROM myTable_Name" ----------

ID_

Hi Peter,

it is a long shot but you could check your “gatling.conf” since the default Gatling setup use Google Analytics

enableGA = true # Very light Google Analytics, please support

Maybe something else went wrong but it is worth a try

Thanks in advance,

Siegfried Goeschl

Hi Peter,

maybe I do not understand your task but using Gatling to export DB content to a CSV seems like overkill :slight_smile:

Some other approaches are found here - http://stackoverflow.com/questions/356578/how-to-output-mysql-query-results-in-csv-format

Thanks in advance,

Siegfried Goeschl

Hi Siegfried,

Thanks for the reply.

I have tried that but did not work for me. What I want is,

First I have to fetch Ids from database and save those in .csv file. Then from csv I have to fetch random ids for rest call. Dont know how will I do. I think it will not accept two feeders 1. For jdbc to save csv and

  1. That generated csv of IDs as an input for Rest calls.

Its very complicated to find help for Gatling.

here is the question:
http://stackoverflow.com/questions/42440394/how-to-generate-csv-file-using-gatling-from-database

I found one link https://github.com/tototoshi/scala-csv Have to add dependencies in build.sbt but I dont have any build.sbt file.

If possible please help.

IGNORE ERROR mentioned in question:

Throws below Error

 java.lang.OutOfMemoryError: Java heap space
    Dumping heap to java_pid13708.hprof ...
    Heap dump file created [610694252 bytes in 1.959 secs]
    Uncaught error from thread [GatlingSystem-scheduler-1] shutting down JVM since 'akka.jvm-exit-on-fa
    tal-error' is enabled for ActorSystem[[ERROR] [02/27/2017 10:14:03.347] [GatlingSystem-scheduler-1]
     [ActorSystem(GatlingSystem)] exception on LARS? timer thread
    java.lang.OutOfMemoryError: Java heap space
            at akka.actor.LightArrayRevolverScheduler$$anon$8.nextTick(Scheduler.scala:409)
            at akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:375)
            at java.lang.Thread.run(Unknown Source)
    GatlingSystem
    ][INFO] [02/27/2017 10:14:03.351] [GatlingSystem-scheduler-1] [ActorSystem(GatlingSystem)] starting
     new LARS thread

    java.lang.OutOfMemoryError: Java heap space[ERROR] [02/27/2017 10:14:03.356] [GatlingSystem-schedul
    er-1] [ActorSystem(GatlingSystem)] Uncaught error from thread [GatlingSystem-scheduler-1] shutting
    down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
    java.lang.OutOfMemoryError: Java heap space
            at akka.actor.LightArrayRevolverScheduler$$anon$8.nextTick(Scheduler.scala:409)
            at akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:375)
            at java.lang.Thread.run(Unknown Source)
            at akka.actor.LightArrayRevolverScheduler$$anon$8.nextTick(Scheduler.scala:409)
            at akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:375)
            at java.lang.Thread.run(Unknown Source)
    Press any key to continue . . .