Using Oracle Database as the query store for the HTTP JSON API

I am testing the use of Oracle Database as the query store for the HTTP JSON API with the following config,

{
  server {
    address = "localhost"
    port = 7575
  }
  ledger-api {
    address = "localhost"
    port = 5011
  }
  query-store {
    base-config {
        user = "SYS"
        password = "Password1"
        driver = "oracle.jdbc.OracleDriver"
        url = "jdbc:oracle:thin:@//localhost:5432/"

        // prefix for table names to avoid collisions, empty by default
        table-prefix = "foo"

        // max pool size for the database connection pool
        pool-size = 12
        //specifies the min idle connections for database connection pool.
        min-idle = 4
        //specifies the idle timeout for the database connection pool.
        idle-timeout = 12s
        //specifies the connection timeout for database connection pool.
        connection-timeout = 90s
    }
    // option setting how the schema should be handled.
    // Valid options are start-only, create-only, create-if-needed-and-start and create-and-start
    start-mode = "create-if-needed-and-start"
  }
}

When I started the JSON API with this config using daml json-api -c myconfig.conf, I got the following error:

2023-07-19 05:34:43.103 [http-json-ledger-api-akka.actor.default-dispatcher-5] ERROR com.daml.http.Main - Cannot start server, context: {instance_uuid: "c8cca4eb-5026-402f-86c7-cf4d7bfdca85"}
java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:oracle:thin:@localhost:5432/
	at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:112)
	at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:336)
	at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:109)
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
	at com.daml.dbutils.ConnectionPool$.dataSource(Connection.scala:69)
	at com.daml.dbutils.ConnectionPool$.connect(Connection.scala:45)
	at com.daml.http.dbbackend.ContractDao$.$anonfun$apply$4(ContractDao.scala:112)
	at scala.util.Either.map(Either.scala:382)
	at com.daml.http.dbbackend.ContractDao$.$anonfun$apply$2(ContractDao.scala:106)
	at scala.util.Either.flatMap(Either.scala:352)
	at com.daml.http.dbbackend.ContractDao$.apply(ContractDao.scala:101)
	at com.daml.http.Main$.$anonfun$main$5(Main.scala:120)
	at scala.Option.map(Option.scala:242)
	at com.daml.http.Main$.$anonfun$main$4(Main.scala:120)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100)
	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49)
	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: java.sql.SQLException: No suitable driver
	at java.sql/java.sql.DriverManager.getDriver(DriverManager.java:300)
	at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:104)
	... 27 common frames omitted

Where can I configure the location of this driver?

1 Like

Hi @rexng,

Your configuration looks correct. Which version of the JSON API server are you using? Is it by any chance the community edition?

Kind Regards,
Mate

1 Like

Hi @Mate_Varga, apologies you are right. It works fine when I switched to use the enterprise edition of the HTTP JSON API server.

1 Like