org.h2.jdbc.JdbcSQLException, Schema "XXX" not found

Gandalf Source

I am trying to run tests of my play framework application with scalatest. I am using evolutions to initialize a database state but only for testing. Therefore I am using the following libraryDependencies:

  jdbc % Test,
  evolutions % Test,
  "com.h2database" % "h2" % "1.4.197" % Test,

My application.conf looks like that:

include "application.conf"

dbUrl="jdbc:h2:mem:xxx;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=create schema if not exists xxx\\;set schema xxx;DATABASE_TO_UPPER=FALSE;"

slick.dbs {
    default {
        profile="slick.jdbc.H2Profile$"
        db.driver="org.h2.Driver"
        db.url=${dbUrl}
        db.user="sa"
        db.password=""
    }
}

db {
    default {
        url=${dbUrl}
        profile="slick.jdbc.H2Profile$"
        driver="org.h2.Driver"
        username="sa"
        password=""
    }
}

I need to use both slick and jdbc configuration since my classes use slick while evolutions use jdbc. I got the following error:

org.h2.jdbc.JdbcSQLException, with message: Schema "XXX" not found; SQL statement: insert into xxx.movies (title,year,country,image,type_id,should_be_send) values (?,?,?,?,?,?) [90079-197]. (RunSpec.scala:19)

What is going on? Is this possible to get rid of the xxx schema in the slick query above? I was struggling with similar error for test evolutions and I have finally got rid of that with DATABASE_TO_UPPER=FALSE but it does not work for slick config.

Regards

scalaplayframeworkh2scalatest

Answers

comments powered by Disqus