8

我正在通过 Play Framework 2.0 开发一个 Web 应用程序。

因为我需要访问 DB2 数据库,所以我在应用程序的 application.conf 文件中添加了以下几行:

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

我成功连接到该数据库,但出现以下异常:

[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]

为了解决这个问题,我尝试禁用 Evolutions,在 application.conf 文件中设置以下行:

evolutions=disabled
evolutions.enable=false

但我总是得到上述例外。

谁可以帮我这个事?

谢谢

4

2 回答 2

7

OK... Finally found out the origin of the problem...

Like I said I am using Play Framework 2.0 and was working in the forms tutorial project that comes with this version of Play...

As it turns out the command to disable Evolutions is neither:

evolutions=disabled evolution=disabled

... But rather:

evolutionplugin=disabled

Thanks

于 2012-05-02T16:45:42.420 回答
2
于 2012-05-02T16:27:09.433 回答