I have been having a problem with the sql. I have been trying to build a login system that will read a username and password from an oracle DB. When I connect and carry out the command
String sql="select * from tutilizadores where username= ? and password= ?";
I get the error message ORA-00942. The table has been created under 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.
答案 0 :(得分:0)
The number of issues is usually limited to those few options:
schema.tutilizadores
. If not sure, then consider schema as the username used to create the table. For verifying what the issue is, consider executing and providing the output of following SQL:
SELECT table_name, owner
FROM dba_tables
WHERE lower(table_name) = 'tutilizadores'