codecentric / gatling-jdbc

JDBC support for Gatling
Apache License 2.0
23 stars 18 forks source link

Can't make a request #1

Closed TrickyDoodle closed 6 years ago

TrickyDoodle commented 6 years ago

Hi, Ronny.

I've installed your extension with maven and now trying to use it to connect to oracle db. My code is like the following:

  val jdbcConfig = jdbc
    .url("jdbc:oracle:thin:@//dbhost:1521/scheme")
    .username("user")
    .password("pass")
    .driver("oracle.jdbc.OracleDriver")
val request=
  exec(jdbc("selection")
    .select("age")
    .from("people"))

In .pom file I have:

              <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>12.2.0.1</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>gatling-jdbc_2.12</artifactId>
            <version>1.0.0</version>
        </dependency>

My scenario consists of only one action. When I launch my script, in a log I can see only this:

================================================================================
2018-05-30 15:30:44                                           0s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=0      KO=1     )
> selection                                                (OK=0      KO=1     )
---- Errors --------------------------------------------------------------------
> <no-message>                                                        1 (100,0%)

---- SC01 ---------------------------------------------------------------------
[##########################################################################]100%
          waiting: 0      / active: 0      / done:1     
================================================================================

Can you advice me please, what I'm doing wrong?

rbraeunlich commented 6 years ago

Hey @TrickyDoodle since testing with an Oracke Database is not so easy for me, could you please set your log level to trace and share the output with me? If you run your Gatling simulation directly from your project you can place a logback.xml file under src/test/resources. To have everything placed in a file you could configure it like this:

<configuration>

    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <file>./gatling.log</file>
        <append>true</append>
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
        </encoder>
    </appender>

    <root level="trace">
        <appender-ref ref="FILE" />
    </root>
</configuration>

And if you downloaded the Gatling bundle there should be a logback.xml in the conf directory.

TrickyDoodle commented 6 years ago

I can't see anything meaningful in a log:

13:03:38.009 [TRACE] i.g.a.Gatling$ - Starting
13:03:38.551 [TRACE] i.g.a.Gatling$ - Configuration loaded
13:03:39.239 [INFO ] a.e.s.Slf4jLogger - Slf4jLogger started
13:03:39.479 [TRACE] i.g.a.Gatling$ - ActorSystem instantiated
13:03:39.546 [TRACE] i.g.a.Gatling$ - Runner instantiated
13:03:40.237 [TRACE] i.g.app.Runner - Running
13:03:44.856 [TRACE] i.g.app.Runner - Simulation instantiated
13:03:44.874 [TRACE] i.g.app.Runner - Simulation params built
13:03:44.875 [TRACE] i.g.app.Runner - Before hooks executed
13:03:45.019 [INFO ] i.g.c.s.w.LogFileDataWriter - Initializing
13:03:45.020 [INFO ] i.g.c.s.w.ConsoleDataWriter - Initializing
13:03:45.033 [INFO ] i.g.c.s.w.ConsoleDataWriter - Initialized
13:03:45.107 [INFO ] i.g.c.s.w.LogFileDataWriter - Initialized
13:03:45.245 [TRACE] i.g.app.Runner - CoreComponents instantiated
13:03:45.400 [TRACE] i.g.app.Runner - Asking Controller to start
13:03:45.525 [DEBUG] i.g.c.a.Exit - End user #1
13:03:45.527 [DEBUG] i.g.c.c.i.Injector - Start user #1
13:03:45.529 [DEBUG] i.g.c.c.Controller - End user #1
13:03:45.535 [DEBUG] i.g.c.c.i.Injector - Injecting 1 users, continue=false
13:03:45.537 [INFO ] i.g.c.c.Controller - InjectionStopped expectedCount=1
13:03:45.537 [INFO ] i.g.c.c.Controller - All users are stopped
13:03:45.699 [INFO ] i.g.c.c.Controller - StatsEngineStopped
13:03:45.700 [TRACE] i.g.app.Runner - After hooks executed

Also, I changed my db credentials and set incorrect password intentionally - the messages in a log stayed the same (for example, I got no warnings for incorrect password from oracle).

Can I do something else to provide more info?

rbraeunlich commented 6 years ago

Hey @TrickyDoodle if you change the connection string to an invalid one, do you see an error?

rbraeunlich commented 6 years ago

Hey @TrickyDoodle do you have any update on this issue?

sgarnepudi commented 6 years ago

Hi Ronny, @rbraeunlich

I have a similar issue while trying to connect to Oracle. If I give an invalid connection string its failing

23:04:50.398 [TRACE] i.g.app.Runner - Simulation instantiated 23:04:50.407 [TRACE] i.g.app.Runner - Simulation params built Exception in thread "main" java.sql.SQLRecoverableException: IO Error: Unknown host specified at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at io.gatling.jdbc.feeder.JdbcFeederSource$.apply(JdbcFeederSource.scala:29)

but when its valid its not able to connect and I never see the before hook execution.

Task :gatlingRun 12:41:15.903 [TRACE] i.g.a.Gatling$ - Starting 12:41:16.072 [TRACE] i.g.a.Gatling$ - Configuration loaded 12:41:16.345 [INFO ] a.e.s.Slf4jLogger - Slf4jLogger started 12:41:16.357 [TRACE] i.g.a.Gatling$ - ActorSystem instantiated 12:41:16.358 [TRACE] i.g.a.Gatling$ - Runner instantiated 12:41:16.376 [TRACE] i.g.app.Runner - Running 12:41:16.863 [TRACE] i.g.app.Runner - Simulation instantiated 12:41:16.879 [TRACE] i.g.app.Runner - Simulation params built <===========--> 85% EXECUTING [1m 54s] :gatlingRun

can you provide any insight?

rbraeunlich commented 6 years ago

Hi @sgarnepudi I will try to find a way to use an Oracle database somehow. Still, regarding the stacktrace you've posted, I can see that you're using JdbcFeederSource. That one is part of Gatling's "core". If you have a problem with this one please open a bug directly in the Gatling project.

rbraeunlich commented 6 years ago

Hello @sgarnepudi @TrickyDoodle I managed to find an OracleDatabase to connect to and it worked without any problem. ScalikeJDBC prints out the following two statements

11:25:49.053 [ScalaTest-run-running-JdbcProtocolSpec] DEBUG scalikejdbc.ConnectionPool$ - Registered connection pool : ConnectionPool(url:jdbc:oracle:<drivertype>:@<database>, user:user) using factory : <default>
11:25:49.056 [ScalaTest-run-running-JdbcProtocolSpec] DEBUG scalikejdbc.ConnectionPool$ - Registered singleton connection pool : ConnectionPool(url:jdbc:oracle:<drivertype>:@<database>, user:user)

after it created the driver and the connection. Could you maybe set a breakpoint in de.codecentric.gatling.jdbc.protocol.JdbcProtocol and check if the driver and connection pool creation work?

sgarnepudi commented 6 years ago

@rbraeunlich I figured the issue was with the large result set. I narrowed down the results and it started working as expected. Please ignore the question.

rbraeunlich commented 6 years ago

Hey @sgarnepudi I'm glad it wasn't my fault ;) I will close this issue now. Feel free to create a feature request for adding `LIMIT´ to selects.