我嘗試這個查詢查詢在德比嵌入式數據庫
String sql1="select * from custinf";
try {
stmt=conn.createStatement();
stmt.execute(sql1);
stmt.close();
} catch (SQLException ex) {
Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
}
它拋出
java.sql.SQLSyntaxErrorException: Table/View 'CUSTINF' does not exist.
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ClientStatement.execute(Unknown Source)
at com.atuts.cms.database.Database.addCustomer(Database.java:57)
at com.atuts.cms.database.Database.main(Database.java:31)
Caused by: ERROR 42X05: Table/View 'CUSTINF' does not exist.
at org.apache.derby.client.am.ClientStatement.completeSqlca(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
at org.apache.derby.client.am.ClientStatement.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.am.ClientStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.ClientStatement.executeX(Unknown Source)
... 3 more
當我查詢更改爲String sql1="select * from \"custinf\""
;它正在工作。我在使用mysql數據庫時沒有遇到這個問題。有人可以解釋嗎?
*表或視圖'CUSTINF'是否存在? –
存在其他明智的第二個查詢將無法正常工作「select * from」custinf「」 – Burusothman
請參閱https://stackoverflow.com/questions/12203787/derby-database-table-column-name-format-inconsistent-in-詢問 –