title: Simple mysql select slower in java than in MySQL Workbench
body: <p>My scala code running a select performs an order of magnitude slower than issuing the same query on MySQL Workbench. The time between my debug prints <code>connection made</code> and <code>query returned</code> is exceptionally long compared to the same query in MySQL Workbench, all other steps are fast. Of course I am using the same database user in both cases. </p>
  
  <pre><code>import java.sql.{Connection,DriverManager,ResultSet}
  
  object JavaSQL extends App {
  
    val driver = "com.mysql.jdbc.Driver"
    val url = ..
    val user = ..
    val password = ..
  
    println("loading driver")
    Class.forName(driver) // loads the driver
    println("driver loaded")
  
    val connection = DriverManager.getConnection(url, user, password)
    println("connection made")
  
    val rs: ResultSet = connection.createStatement.executeQuery("SELECT * from Foo")
    println("query returned")
  
    connection.close
  
  }
  </code></pre>
  
  <p>build.sbt:</p>
  
  <pre><code>lazy val project = (project in file("."))
    .settings(
      scalaVersion := "2.11.7",
      libraryDependencies ++= Seq("mysql" % "mysql-connector-java" % "5.1.38")
    )
  </code></pre>
  
  <p>What should I basically do to get it at par? It is as slow as running the same query in mysql's command-line. Workbench must be using some special flags.</p>
  
  <p>I've used JDBC/SQL abstractions for a while and now returning to java.sql so please be gentle..</p>