mvn gatling:execute freeze due to query

Hello,

I’ve a ws.properties which need to run 2 queries.

But when I run my application with : mvn -X gatling:execute -DlistOfWS=testSimple -DplateauDuration=300 -DrampDuration=60 -DrequestPerSec=300 -DnbRepeat=10
the terminal freeze at :

14:15:05,444 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
14:15:05,444 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
14:15:05,491 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
14:15:05,506 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
14:15:05,615 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
14:15:05,615 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[ROOT]
14:15:05,615 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
14:15:05,615 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7a0ac6e3 - Registering current configuration as safe fallback point

And I can only abort the execution.

Here my 2 queries :

queryJDBC1=DELETE FROM APPIVB.TDEMANDESOUSCRIPTION WHERE ID in ('4001111001')
queryJDBC2=INSERT INTO APPIVB.TDEMANDESOUSCRIPTION (ID, CREATIONDATE, MODIFICATIONDATE, STATUTGLOBAL, WM_DOCUMENT_TYPE, EMMENAGEMENTDATE, LOG_NUMPDL, TIT_NUMMBP, TIT_CIVILITE, TIT_NOM, TIT_PRENOM, TIT_EMAIL, COB_NOMTITULAIRE, COB_IBAN, CTR_NUMACO, CTR_NUMPC, CTR_NUMDEMANDESIMM, CTR_NUMCONTRATFOURNITUREELEC, CTR_NUMCONTRATFOURNITUREGAZ, XML, STATUTELEC, STATUTGAZ) VALUES ('4001111001', TO_TIMESTAMP ('30/11/16 16:00:00,000000000','dd/mm/yy hh24:mi:ss,FF9'), null, 'EN_COURS', 'pscmcpdemandesouscription.document.v1:demandeSouscription', null, null, 9001111001, 'M', null, null, null, null, null, null, null, null, null, null, '<?xml version=\"1.0\"?><ns:demandeSouscription xmlns:ns=\"http://www.edf.fr/psc/demandeSouscription/objet/v1\"><infosDemande><numDemande>4001111001</numDemande><dateCreation>2016-11-22 14:23:14.586</dateCreation><typeDemande>1CTRCT10</typeDemande><situationUsage>MES_Standard</situationUsage><statutGlobal>statutGlobal</statutGlobal><energie>BIENERGIE</energie></infosDemande><infosLogement><numeroPDL>00009001111001</numeroPDL><adresse><nomRue>Rue du Taur</nomRue><numRue>789</numRue><codePostal>31001</codePostal><complement>complement01</complement><ville>ville01</ville><lieuDit>lieuDit01</lieuDit><codeINSEE>codeINSEE01</codeINSEE></adresse><caracteristiquesDuLogement><statutOccupant>statutOcc01</statutOccupant><typeResidence>typeResidence01</typeResidence><typeLogement>logement01</typeLogement><surface>100</surface><chauffage>GAZ</chauffage><nombreOccupants>2</nombreOccupants><ECS>ECS01</ECS><DPE>DPE01</DPE><anneeConstruction>1990</anneeConstruction></caracteristiquesDuLogement><equipementDuLogement><equipement><attribut>TYPECHAUFFAGEALTERNATIF</attribut><valeur>valeur1</valeur></equipement></equipementDuLogement><travaux><typeTravaux><attribut>CHANGEMENTFENETRE</attribut><valeur>true</valeur></typeTravaux></travaux><intervention><typeIntervention>intervention</typeIntervention><rendezVous><plage>plage</plage></rendezVous></intervention><electricite><compteur><communicant>true</communicant><typeCompteur>linky</typeCompteur></compteur><historiqueMesure><dateProchaineReleve>2020-01-19</dateProchaineReleve></historiqueMesure></electricite><gaz><numPCE>11119001111001</numPCE><dateProchaineReleve>2020-01-19</dateProchaineReleve></gaz></infosLogement><infosTitulaire><numeroBP>9001111001</numeroBP><identite><civilite>M</civilite><nom>Alphand</nom><prenom>Luc</prenom></identite><coordonnees><numTelFixe>0556987456</numTelFixe><numTelMobile>0698745236</numTelMobile><email>9001111001@yopmail.com</email></coordonnees><listeActionCom><identifiant><action>action01</action><statut>statut01</statut></identifiant></listeActionCom><identiteCoTitulaire><civilite>Mme</civilite><nomCoTitulaire>Alphand</nomCoTitulaire><prenomCoTitulaire>Maria</prenomCoTitulaire></identiteCoTitulaire></infosTitulaire><infosCoordonneesbancaires><paiement><modePaiement>true</modePaiement><rythmeFacturation>rythmefacturation01</rythmeFacturation></paiement><adresseFacturation><nomRue>Avenue de Grande bretagne</nomRue><codePostal>31001</codePostal><ville>ville01</ville><pays>France</pays></adresseFacturation><coordonneesBancaire><nomTitulaire>Durand</nomTitulaire><IBAN>FR03596974684326</IBAN></coordonneesBancaire></infosCoordonneesbancaires></ns:demandeSouscription>', null, null)

If I don’t put APPIVB to table TDEMANDESOUSCRIPTION, my execution run until the end but nothing happen in my database.

So it looks like you’re using https://github.com/rbraeunlich/gatling-jdbc
This extension is a third party, so it’s not maintained here. I recommend you directly reach out to its author, probably on its own bugtracker on github.

No, a developper developp this class :

package pscPerformanceSimulation.DBConnection

import java.sql._

class DatabaseConfig  {

  // jdbc driver name and database URL
  val JDBC_DRIVER = "oracle.jdbc.OracleDriver"
  val DB_URL      = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=XXX)(PORT=1521))(FAILOVER=on)(LOAD_BALANCE=on))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XXX)))"

  // database credentials
  val USER = "user as userdba"
  val PASS = "pass"

  var conn: Connection = _
  var stmt: Statement = _

  def insertQuery(query : String): Unit = {
    try {
      Class.forName(JDBC_DRIVER)
      conn = DriverManager.getConnection(DB_URL, USER, PASS)
      stmt = conn.createStatement

      // create the statement, and run the select query
      val statement = conn.createStatement()
      statement.executeUpdate(query)
      conn.commit()

      // cleanup
      stmt.close()
      conn.close()
    } catch {
      case e: Throwable => e.printStackTrace
    } finally {
      conn.close()
    }

  }

  def executeQuery(query : String): Unit = {
    try {
      Class.forName(JDBC_DRIVER)
      conn = DriverManager.getConnection(DB_URL, USER, PASS)

      stmt = conn.createStatement
      val rs: ResultSet = stmt.executeQuery(query)
      // cleanup
      stmt.close()
      conn.close()
    } catch {
      case e: Throwable => e.printStackTrace
    } finally {
      conn.close()
    }
  }
}

And I use it in WebServiceConfig.scala :

if(configPlatform.getString("queryJDBC1") != "") {
  val DBConnection = new DatabaseConfig()
  val query1 = configPlatform.getString("queryJDBC1")
  if (query1.split(" ").head == "INSERT") {
  DBConnection.insertQuery(query1)
} else {
  DBConnection.executeQuery(query1)
  }
}

And in my ws.properties :

queryJDBC1=DELETE FROM APPIVB.TDEMANDESOUSCRIPTION WHERE ID in ('1')

In my pom.xml :

<dependency>
   <groupId>com.oracle</groupId>
   <artifactId>ora-jdbc</artifactId>
   <version>6</version>
</dependency>