此方法不斷拋出標題中的異常,我找不到原因,我通過連接創建了其他表,並創建了所有引用的表。我正在使用嵌入式JavaDB。爲什麼我會遇到SQLSyntaxErrorException - 遇到「」?
private void createEvidenceTable() throws SQLException
{
Statement evidenceTable = CONNECTION.createStatement();
evidenceTable.execute("CREATE TABLE evidence("+
"evidence_id INTEGER NOT NULL PRIMARY KEY,"+
"date_added VARCHAR(6) NOT NULL,"+
"evidence_dated VARCHAR(6) NOT NULL,"+
"evidence_file varchar(20),"+
"evidence_text VARCHAR(10),"+
"source_location_id INTEGER,"+
"source_person_id INTEGER,"+
"evidence_type VARCHAR(20),"+
"CONSTRAINT evidence__location_source FOREIGN KEY(source_location_id) REFERENCES location_source,"+
"CONSTRAINT evidence_person_source FOREIGN KEY(source_person_id) REFERENCES person_source,"+
"CONSTARINT evidence_evidence_type FOREIGN KEY(evidence_type) REFERENCES evidence_types)");
}
你試圖在哪個數據庫中創建表? – 2009-11-29 20:01:29
JavaDB,嵌入式,抱歉只做了一個編輯。 – chrisg 2009-11-29 20:02:14