Skip to content
Advertisement

PostgreSql unable to resolve table user

My problem is that intellij raise an error that unable to resolve table user.

Table is created in database it can be seen in database in Intellij but it looks like compiler doesn’t have an access to it. Did someone have similiar problem?

enter image description here

public void getUser(String user) {
        connect();
        String SQL = "SELECT users , password  FROM users WHERE users = ?";
        try {
            pstmt = connection.prepareStatement(SQL);
            pstmt.setString(1, user);
            pstmt.executeUpdate();
            ResultSet rs = pstmt.executeQuery(SQL);
            System.out.println(rs.getString("password"));
        } catch (SQLException ex) {
            System.out.println(ex.getMessage());
        }

Advertisement

Answer

If you can confirm that the table exists and you connect to the right database, the error message might be misleading. This can be caused by incorrect database/dialect settings as well as other IntelliJ db connection settings.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement