2017-07-13 53 views
0

org.postgresql.util.PSQLException: ERROR: column "feedbackid" does not exist Position: 8PSQLException:錯誤:列不存在位置:8

我收到此錯誤但無法理解背後的原因。 它顯示: - **

org.postgresql.util.PSQLException: ERROR: column "feedbackid" does not exist Hint: Perhaps you meant to reference the column "feedback.feedbackId". Position: 8

**

數據庫表中postgres的:

create table `company`.`feedback` (

feedbackId INT(10)NOT NULL, feedbackActionId INT(12)NOT NULL, description varchar(200)DEFAULT NULL, feedbackText varchar(2000)DEFAULT NULL, email varchar(100)NOT NULL, createdDate date NOT NULL );

database table in postgres

public Feedback getFeedbackById(int id) throws SQLException, ClassNotFoundException { 
    conn = DBConnection.setDBConnection(); 
    String sqlQuery = "select feedbackId, feedbackActionId, description, feedbackText, email, createdDate" + 
          "from feedback " + 
          " where feedbackId = " + id ; 
    DBConnection dbConn = new DBConnection(); 
    ResultSet resultSet = dbConn.getResultSet(sqlQuery, conn); 
    int feedbackId = resultSet.getInt("feedbackId"); 
    int feedbackActionId = resultSet.getInt("feedbackActionId"); 
    String description = resultSet.getString("description"); 
    String feedbackText = resultSet.getString("feedbackText"); 
    String email = resultSet.getString("email"); 
    Date createdDate = resultSet.getDate("createdDate"); 
    feedback = new Feedback(feedbackId, feedbackActionId, description, feedbackText, email, createdDate); 

    resultSet.close(); 

    return feedback; 
} 

在此先感謝。

+0

你可以在你的問題中包括你的反饋表架構嗎? –

+1

列名 –

+1

從「反饋」更改爲「來自反饋」後,缺少空格 –

回答

0

此問題可能對您有所幫助。看起來Postgres對列名是大小寫敏感的。您可能需要在引號中包含字段名稱。 Are PostgreSQL column names case-sensitive?

+0

感謝您的支持。 –

+0

@AnshuAshish如果它解決了你的問題,請接受這個答案或upvote。 –