PSQLException:错误:列不存在位置:8
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 );
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;
}
在此先感谢。
此问题可能对您有所帮助。看起来Postgres对列名是大小写敏感的。您可能需要在引号中包含字段名称。 Are PostgreSQL column names case-sensitive?
感谢您的支持。 –
@AnshuAshish如果它解决了你的问题,请接受这个答案或upvote。 –
你可以在你的问题中包括你的反馈表架构吗? –
列名 –
从“反馈”更改为“来自反馈”后,缺少空格 –