So I have a Scala/Play application that uses multiple MySQL and PostgreSQL databases (on the same server), however I have a problem with PostgreSQL.
This is the configuration:
db.postgres.driver=org.postgresql.Driver
db.postgres.url="jdbc:postgresql://localhost:5432/"
db.postgres.user=root
db.postgres.password=root
db.mysql.driver="com.mysql.jdbc.Driver"
db.mysql.url="jdbc:mysql://localhost"
db.mysql.user=root
db.mysql.pass=root
This simple method works fine with MySQL:
def test = DB("mysql").withDynSession {
val rez = sql"""select * from dbName.test""".as[TestRow].list
println(rez)
}
But exactly the same method with Postgres
def test = DB("postgres").withDynSession {
val rez = sql"""select * from dbName.test""".as[TestRow].list
println(rez)
}
throws an error:
org.postgresql.util.PSQLException: ERROR: relation "dbName.test" does not exist
How come these methods are identical, but MySQL example works and PostgreSQL doesn't?
My stack:
- Scala 2.10.3
- Play 2.2.2
- Slick 2.0
- PostgreSQL 9.3.3
- MySQL 5.6.16
- Java 8
Postgresql JDBC driver version is 9.3-1101-jdbc41