table 或视图不存在

table or view does not exist

使用 mybatis 查询数据库和

抛出以下错误,

### Error querying database.  Cause: java.sql.SQLException: ORA-00942: table or view does not exist
### The error may exist in com/pulse/jdbcservices/cob/pulset24user/PulseT24UserMapper.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT userid,username,classification,attributes from PULSET24USER
### Cause: java.sql.SQLException: ORA-00942: table or view does not exist

我的映射器 class 代码是

@Select("SELECT userid,username,classification,attributes from PULSET24USER")
public List<PulseT24User> getAllRecords();

请给我解决这个问题的方法

您可能没有为视图或 table PULSET24USER 设置正确的权限。也请检查拼写是否正确。

1- 验证您的 table 是否存在于 SQL 开发人员中(可以通过简单的 select... 实现)多种方法。

select * from PULSET24USER;

2- 我怀疑您在 SQL Developper 中使用的用户与您的 Java 程序中的用户不同,然后错误是由于缺少 synonym/schema 名称引起的。

来自 ora-code 网站:

ORA-00942: table or view does not exist Cause: The table or view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required. Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it. Action: Check each of the following: the spelling of the table or view name. that a view is not specified where a table is required. that an existing table or view name exists. Contact the database administrator if the table needs to be created or if user or application privileges are required to access the table.

Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted.

希望对您有所帮助。