Play Framework using Oracle Database - ORA-00942: table or view does not exist

为君一笑 提交于 2019-12-07 20:53:54

问题


I can't solve my problem with my local Oracle database. I'm tryong to connect to my local Oracle database (Oracle Database 11g Express Edition) Later on I will use JNDI to another Oracle Database, but I think this should still work. Driver: ojdbc6.jar in /lib

db.default.driver=oracle.jdbc.driver.OracleDriver
db.default.url="jdbc:oracle:thin:@localhost:1521:xe"
db.default.user="user"
db.default.pass="pass"

So I know I do connect to the database, but the error is that it says that the table does not exist. I'm not even creating or querying to a table (no model exists - but I've tried with having a model too, same error). Something seems to be wrong in the beginning and I don't know how to Debug this.

Error:

**java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist**
 oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
 oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:400)
 oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:926)
 oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
 oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:200)
 oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:543)
 oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:197)
 oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:1213)
 oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1492)
 oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1710)
 oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:2006)
 oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:1709)
 com.jolbox.bonecp.StatementHandle.executeQuery(StatementHandle.java:503)
 play.api.db.evolutions.Evolutions$.executeQuery(Evolutions.scala:118)
 play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:334)
 play.api.db.evolutions.Evolutions$.evolutionScript(Evolutions.scala:306)
 play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:435)
 play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:478)
 play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:434)
 play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:432)
 scala.collection.immutable.List.foreach(List.scala:309)
 play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:432)
 play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63)
 play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:63)
 scala.collection.immutable.List.foreach(List.scala:309)
 play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:63)
 play.api.Play$$anonfun$start$1.apply(Play.scala:63)
 play.api.Play$$anonfun$start$1.apply(Play.scala:63)

When reading about it I've only found that I might not have permission to some table, but the thing is that I use the same login in Oracle SQL Developer and it works.


回答1:


Try to manually create a play_evolutions table with the following columns (by adapting the types to the ones used by Oracle):

id int not null primary key, hash varchar(255) not null, 
applied_at timestamp not null, 
apply_script text, 
revert_script text, 
state varchar(255), 
last_problem text



回答2:


As nico_ekito wrote, you need to create this table manually.

This one works for me:

CREATE TABLE play_evolutions
(
  id Number(10,0) Not Null Enable,
  hash VARCHAR2(255 Byte),
  applied_at Timestamp Not Null,
  apply_script clob,
  revert_script clob,
  state Varchar2(255),
  last_problem clob,
  CONSTRAINT play_evolutions_pk PRIMARY KEY (id)
); 



回答3:


In conf/application.conf

Un-comment the following line:

evolutionplugin=disabled

This is if you don't need Evolutions (to track schema changes).



来源:https://stackoverflow.com/questions/15250483/play-framework-using-oracle-database-ora-00942-table-or-view-does-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!