title: Bigquery - Simba JDBC error with scala anorm
body: <p>I'm trying to query bigquery from scala (2.11.8) using Simba JDBC Driver (bigquery jdbc 4.2) through anorm (2.5.3) and play framework (2.5.8) on Ubuntu 16.04. This si my code:</p>
  
  <pre><code>class BigQueryController @Inject() (@NamedDatabase("bigquery") db: Database) extends Controller {
  
      case class VixStudioProduct(short_name: String)
  
      def test = Action {
  
          val names: Seq[String] = db.withConnection { implicit connection =&gt;
              val query = SQL("SELECT name FROM dataset.table")
              query.as(SqlParser.scalar[String].*)
          }
          Logger.debug(s"products - $names")
          Ok
      }
  
  }
  </code></pre>
  
  <p>but I'm getting the following error.</p>
  
  <pre><code>2017-03-02T12:58:44,428-0300 [error] [org.jdbcdslog.ConnectionLogger      ] - java.sql.Connection.prepareStatement: 
      throws exception: java.sql.SQLException: [Simba][BigQueryJDBCDriver](100038) Error getting query result object.
      java.sql.SQLException: [Simba][BigQueryJDBCDriver](100038) Error getting query result object.
          at com.simba.googlebigquery.client.BQClient.getQueryResults(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQDoubleBuffer.getResultsResponse(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQDoubleBuffer.&lt;init(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQResultSet.&lt;init(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQSQLExecutor.&lt;init(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQDataEngine.prepare(Unknown Source)
          at com.simba.jdbc.common.SPreparedStatement.&lt;init(Unknown Source)
          at com.simba.jdbc.jdbc41.S41PreparedStatement.&lt;init(Unknown Source)
          at com.simba.jdbc.jdbc42.S42PreparedStatement.&lt;init(Unknown Source)
          at com.simba.jdbc.jdbc42.JDBC42ObjectFactory.createPreparedStatement(Unknown Source)
          at com.simba.jdbc.common.SConnection.prepareStatement(Unknown Source)
          at com.simba.jdbc.common.SConnection.prepareStatement(Unknown Source)
          at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:310)
          at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.jdbcdslog.GenericLoggingHandler.invoke(GenericLoggingHandler.java:30)
          at com.sun.proxy.$Proxy24.prepareStatement(Unknown Source)
          at anorm.SimpleSql$$anonfun$2.apply(SimpleSql.scala:40)
          at anorm.SimpleSql$$anonfun$2.apply(SimpleSql.scala:39)
          at anorm.SimpleSql.unsafeStatement(SimpleSql.scala:61)
          at anorm.SimpleSql.unsafeStatement(SimpleSql.scala:53)
          at anorm.Sql$$anonfun$preparedStatement$1.apply(Anorm.scala:90)
          at anorm.Sql$$anonfun$preparedStatement$1.apply(Anorm.scala:90)
          at resource.DefaultManagedResource.open(AbstractManagedResource.scala:110)
          at resource.AbstractManagedResource.acquireFor(AbstractManagedResource.scala:87)
          at resource.ManagedResourceOperations$$anon$2.acquireFor(ManagedResourceOperations.scala:49)
          at resource.DeferredExtractableManagedResource.acquireFor(AbstractManagedResource.scala:27)
          at resource.ManagedResourceOperations$class.apply(ManagedResourceOperations.scala:26)
          at resource.DeferredExtractableManagedResource.apply(AbstractManagedResource.scala:24)
          at resource.ManagedResourceOperations$class.acquireAndGet(ManagedResourceOperations.scala:25)
          at resource.DeferredExtractableManagedResource.acquireAndGet(AbstractManagedResource.scala:24)
          at anorm.Sql$$anonfun$asTry$1.apply(Anorm.scala:228)
          at anorm.Sql$$anonfun$asTry$1.apply(Anorm.scala:228)
          at scala.util.Try$.apply(Try.scala:192)
          at anorm.Sql$.asTry(Anorm.scala:228)
          at anorm.WithResult$class.asTry(SqlResult.scala:181)
          at anorm.SimpleSql.asTry(SimpleSql.scala:6)
          at anorm.WithResult$class.as(SqlResult.scala:173)
          at anorm.SimpleSql.as(SimpleSql.scala:6)
          at controllers.BigQueryController$$anonfun$asdf$1$$anonfun$1.apply(BigQueryController.scala:26)
          at controllers.BigQueryController$$anonfun$asdf$1$$anonfun$1.apply(BigQueryController.scala:24)
          at play.api.db.DefaultDatabase.withConnection(Databases.scala:155)
          at play.api.db.DefaultDatabase.withConnection(Databases.scala:149)
          at controllers.BigQueryController$$anonfun$asdf$1.apply(BigQueryController.scala:24)
          at controllers.BigQueryController$$anonfun$asdf$1.apply(BigQueryController.scala:18)
          at play.api.mvc.ActionBuilder$$anonfun$apply$14.apply(Action.scala:403)
          at play.api.mvc.ActionBuilder$$anonfun$apply$14.apply(Action.scala:403)
          at play.api.mvc.ActionBuilder$$anonfun$apply$13.apply(Action.scala:371)
          at play.api.mvc.ActionBuilder$$anonfun$apply$13.apply(Action.scala:370)
          at play.api.mvc.Action$.invokeBlock(Action.scala:498)
          at play.api.mvc.Action$.invokeBlock(Action.scala:495)
          at play.api.mvc.ActionBuilder$$anon$2.apply(Action.scala:458)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
          at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:111)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:110)
          at scala.Option.map(Option.scala:146)
          at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:110)
          at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:103)
          at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
          at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
          at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
          at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
          at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
          at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
          at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
          at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
          at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
          at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
          at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:405)
          at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
          at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
          at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
      Caused by: com.simba.support.exceptions.GeneralException: [Simba][BigQueryJDBCDriver](100038) Error getting query result object.
          ... 77 common frames omitted
      Caused by: java.lang.NullPointerException: Required parameter jobId must be specified.
          at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
          at com.google.api.client.util.Preconditions.checkNotNull(Preconditions.java:140)
          at com.google.api.services.bigquery.Bigquery$Jobs$GetQueryResults.&lt;init(Bigquery.java:1248)
          at com.google.api.services.bigquery.Bigquery$Jobs.getQueryResults(Bigquery.java:1221)
          at com.simba.googlebigquery.client.BQClient.getQueryResults(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQDoubleBuffer.getResultsResponse(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQDoubleBuffer.&lt;init(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQResultSet.&lt;init(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQSQLExecutor.&lt;init(Unknown Source)
          at com.simba.googlebigquery.dataengine.BQDataEngine.prepare(Unknown Source)
          at com.simba.jdbc.common.SPreparedStatement.&lt;init(Unknown Source)
          at com.simba.jdbc.jdbc41.S41PreparedStatement.&lt;init(Unknown Source)
          at com.simba.jdbc.jdbc42.S42PreparedStatement.&lt;init(Unknown Source)
          at com.simba.jdbc.jdbc42.JDBC42ObjectFactory.createPreparedStatement(Unknown Source)
          at com.simba.jdbc.common.SConnection.prepareStatement(Unknown Source)
          at com.simba.jdbc.common.SConnection.prepareStatement(Unknown Source)
          at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:310)
          at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.jdbcdslog.GenericLoggingHandler.invoke(GenericLoggingHandler.java:30)
          at com.sun.proxy.$Proxy24.prepareStatement(Unknown Source)
          at anorm.SimpleSql$$anonfun$2.apply(SimpleSql.scala:40)
          at anorm.SimpleSql$$anonfun$2.apply(SimpleSql.scala:39)
          at anorm.SimpleSql.unsafeStatement(SimpleSql.scala:61)
          at anorm.SimpleSql.unsafeStatement(SimpleSql.scala:53)
          at anorm.Sql$$anonfun$preparedStatement$1.apply(Anorm.scala:90)
          at anorm.Sql$$anonfun$preparedStatement$1.apply(Anorm.scala:90)
          at resource.DefaultManagedResource.open(AbstractManagedResource.scala:110)
          at resource.AbstractManagedResource.acquireFor(AbstractManagedResource.scala:87)
          at resource.ManagedResourceOperations$$anon$2.acquireFor(ManagedResourceOperations.scala:49)
          at resource.DeferredExtractableManagedResource.acquireFor(AbstractManagedResource.scala:27)
          at resource.ManagedResourceOperations$class.apply(ManagedResourceOperations.scala:26)
          at resource.DeferredExtractableManagedResource.apply(AbstractManagedResource.scala:24)
          at resource.ManagedResourceOperations$class.acquireAndGet(ManagedResourceOperations.scala:25)
          at resource.DeferredExtractableManagedResource.acquireAndGet(AbstractManagedResource.scala:24)
          at anorm.Sql$$anonfun$asTry$1.apply(Anorm.scala:228)
          at anorm.Sql$$anonfun$asTry$1.apply(Anorm.scala:228)
          at scala.util.Try$.apply(Try.scala:192)
          at anorm.Sql$.asTry(Anorm.scala:228)
          at anorm.WithResult$class.asTry(SqlResult.scala:181)
          at anorm.SimpleSql.asTry(SimpleSql.scala:6)
          at anorm.WithResult$class.as(SqlResult.scala:173)
          at anorm.SimpleSql.as(SimpleSql.scala:6)
          at controllers.BigQueryController$$anonfun$asdf$1$$anonfun$1.apply(BigQueryController.scala:26)
          at controllers.BigQueryController$$anonfun$asdf$1$$anonfun$1.apply(BigQueryController.scala:24)
          at play.api.db.DefaultDatabase.withConnection(Databases.scala:155)
          at play.api.db.DefaultDatabase.withConnection(Databases.scala:149)
          at controllers.BigQueryController$$anonfun$asdf$1.apply(BigQueryController.scala:24)
          at controllers.BigQueryController$$anonfun$asdf$1.apply(BigQueryController.scala:18)
          at play.api.mvc.ActionBuilder$$anonfun$apply$14.apply(Action.scala:403)
          at play.api.mvc.ActionBuilder$$anonfun$apply$14.apply(Action.scala:403)
          at play.api.mvc.ActionBuilder$$anonfun$apply$13.apply(Action.scala:371)
          at play.api.mvc.ActionBuilder$$anonfun$apply$13.apply(Action.scala:370)
          at play.api.mvc.Action$.invokeBlock(Action.scala:498)
          at play.api.mvc.Action$.invokeBlock(Action.scala:495)
          at play.api.mvc.ActionBuilder$$anon$2.apply(Action.scala:458)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:112)
          at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:111)
          at play.api.mvc.Action$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:110)
          at scala.Option.map(Option.scala:146)
          at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:110)
          at play.api.mvc.Action$$anonfun$apply$2.apply(Action.scala:103)
          at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
          at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
          at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
          at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
          at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
          at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
          at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
          at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
          at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
          at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
          at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:405)
          at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
          at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
          at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
          at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
  </code></pre>
  
  <p>and this is the log of bigquery in google cloud platform</p>
  
  <pre><code>serviceData: {
     @type: "type.googleapis.com/google.cloud.bigquery.logging.v1.AuditData"    
     jobInsertRequest: {
      resource: {
       jobName: {
        projectId: "zentinel-datawarehouse"        
       }
       jobConfiguration: {
        query: {
         query: "SELECT id,short_name FROM vix_studio.product   "        
         destinationTable: {…}        
         createDisposition: "CREATE_IF_NEEDED"        
         writeDisposition: "WRITE_EMPTY"        
         defaultDataset: {…}        
        }
        dryRun: true        
       }
       jobStatus: {
        state: "PENDING"        
        error: {…}        
       }
       jobStatistics: {…}      
      }
     }
    }
  </code></pre>
  
  <p>I've found this reported issue <a href="https://issuetracker.google.com/issues/35906079" rel="nofollow noreferrer">https://issuetracker.google.com/issues/35906079</a>
  The cause is the same because anorm use prepared statement.</p>
  
  <p>thanks in advance for your help</p>