Play Framework and DB2

database, db2, java, playframework, playframework-2.0

Solution

A DB2 -204 SQLCODE means:

The object identified by name is not defined in the DB2® subsystem. This SQLCODE can be generated for any type of DB2 object.

...

Verify that the object name was correctly specified in the SQL statement, including any required qualifiers. If it is correct, ensure that the object exists in the system before resubmitting the statement.

It would seem the table `DB2ADMIN.PLAY_EVOLUTIONS` does not exist. If it should exist, try connecting to the database using a SQL client and execute `select * from DB2ADMIN.PLAY_EVOLUTIONS with ur for read only;` to verify the table does exist.

Also, you probably want to use `evolution=disabled` instead of `evolutions=disabled` (see the Play Git commit `providing a way to disable EvolutionPlugin through configuratio…`) in your `application.conf` file.

Problem

I'm develloping a web application over Play Framework 2.0. Since I need to access a DB2 database, I added the following lines to my application's application.conf file: ``` db.mydb.driver=com.ibm.db2.jcc.DB2Driver db.mydb.url="jdbc:db2://host:port/databaseName" db.mydb.user=user db.mydb.password=pass db.mydb.jndiName=databaseName ``` I connected sucessfully to this DB but got the following exceptions: ``` [info] play - datasource [jdbc:db2://host:port/databaseName] bound to JNDI as databaseName [info] play - database [databaseName] connected at jdbc:db2://host:port/databaseName [warn] application - play_evolutions table already existed [error] application - ! @6a8ib4hd7 - Internal server error, for request [GET /] -> play.api.UnexpectedException: Unexpected exception [SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2ADMIN.PLAY_EVOLUTIONS, DRI VER=4.12.55] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anon fun$1.apply(ApplicationProvider.scala:134) ~[play_2.9.1.jar:2.0] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anon fun$1.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0] at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply (ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply (ApplicationProvider.scala:110) ~[play_2.9.1.jar:2.0] at scala.Either$RightProjection.flatMap(Either.scala:277) ~[scala-librar y.jar:0.11.2] Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-2 04, SQLSTATE=42704, SQLERRMC=DB2ADMIN.PLAY_EVOLUTIONS, DRIVER=4.12.55 at com.ibm.db2.jcc.am.hd.a(hd.java:676) ~[db2jcc4.jar:na] at com.ibm.db2.jcc.am.hd.a(hd.java:60) ~[db2jcc4.jar:na] at com.ibm.db2.jcc.am.hd.a(hd.java:127) ~[db2jcc4.jar:na] at com.ibm.db2.jcc.am.mn.c(mn.java:2621) ~[db2jcc4.jar:na] at com.ibm.db2.jcc.am.mn.d(mn.java:2609) ~[db2jcc4.jar:na] at com.ibm.db2.jcc.am.mn.a(mn.java:2085) ~[db2jcc4.jar:na] ``` In order to solve this I tried to disable Evolutions setting the following line in application.conf file: ``` evolutions=disabled evolutions.enable=false ``` But I am allways getting the above exceptions. Can anyone help me on this? Thanks

Original source