简体   繁体   English

java / SQL ORA-00942表或视图不存在

[英]java/SQL ORA-00942 table or view does not exist

I have been having a problem with the sql. 我一直在与SQL问题。 I have been trying to build a login system that will read a username and password from an oracle DB. 我一直在尝试构建一个登录系统,该系统将从oracle数据库读取用户名和密码。 When I connect and carry out the command 当我连接并执行命令时

String sql="select * from tutilizadores where username= ? and password= ?";

I get the error message ORA-00942. 我收到错误消息ORA-00942。 The table has been created under sys. 该表已在sys下创建。 I am confused. 我很困惑。

Here is the code that refers to the problem: 以下是涉及该问题的代码:

        String sql="select * from tutilizadores where username= ? and password= ?";
        PreparedStatement pst = conn.prepareStatement(sql);
        pst.setString(1, USERNAME.getText());
        pst.setString(2, PASSWORD.getText());
        rs=(OracleResultSet)pst.executeQuery();
        if (rs.next()){
        JOptionPane.showMessageDialog(null, "O username e password estavam bem");
        //Fecha a janela
        //close();

        //nova janela-Tutilizadores
        Tutilizadores c = new Tutilizadores();
        c.setVisible(true);
        }

Thanks a lot. 非常感谢。

The number of issues is usually limited to those few options: 问题的数量通常限于以下几种选择:

  1. You are logged in to the wrong database 您登录到错误的数据库
  2. Logged in using the wrong username 使用错误的用户名登录
  3. You are required to qualify the table name with the schema name as in schema.tutilizadores . 您需要使用schema.tutilizadores的模式名来限定表名。 If not sure, then consider schema as the username used to create the table. 如果不确定,则将架构视为用于创建表的用户名。
  4. Somehow you managed to have the table name wrong. 您以某种方式设法使表名错误。 Possibly table is case sensitive: if qualified inside double quotes, case will be literally matched, otherwise oracle will assume uppercase. 表可能是区分大小写的:如果在双引号内限定,则大小写将完全匹配,否则oracle将采用大写形式。

For verifying what the issue is, consider executing and providing the output of following SQL: 为了验证问题所在,请考虑执行并提供以下SQL的输出:

SELECT table_name, owner
FROM dba_tables
WHERE lower(table_name) = 'tutilizadores'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ORA-00942:表或视图不存在 - ORA-00942: Table or view does not exist 在java中收到错误“ ORA-00942:表或视图不存在” - getting error “ORA-00942: table or view does not exist ” in java java.sql.SQLSyntaxErrorException:ORA-00942:表或视图不存在Spring数据源 - java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist Spring Data source Hibernate引起:java.sql.SQLException:ORA-00942:表或视图不存在 - Hibernate Caused by: java.sql.SQLException: ORA-00942: table or view does not exist java.sql.SQLException: ORA-00942: 表或视图不存在 - java.sql.SQLException: ORA-00942: table or view does not exist java.sql.SQLException: ORA-00942: 表或视图不存在? - java.sql.SQLException: ORA-00942: table or view does not exist? java.sql.SQLException: ORA-00942: 表或视图不存在 JPA entityManager.createQuery() - java.sql.SQLException: ORA-00942: table or view does not exist with JPA entityManager.createQuery() java.sql.SQLSyntaxErrorException: ORA-00942: 表或视图不存在 - java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist java.sql.SQLException:ORA-00942:表或视图不存在,每三分之一命中数据库 - java.sql.SQLException: ORA-00942: table or view does not exist, getting in every third hit to database java.sql.SQLException:ORA-00942:表或视图不存在 - java.sql.SQLException: ORA-00942: table or view does not exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM