我想知道如何從texfile導入內容到數據庫(javaDB)。這是我有的代碼,但是我在執行時收到一個錯誤。我也想說明這個表的主鍵是自動遞增的。如何將文本文件導入到javaDB中?
CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE
(null,'EXPENDITURE','C:\Users\Me\Desktop\textforimport.txt',null,null,null,0);
// This is my import code
//這是我的錯誤
Executed successfully in 0.003 s.
Line 1, column 1
Error code 30000, SQL state 38000: The exception 'java.sql.SQLException:
Attempt to modify an identity column 'EXPENDITURE_ID'.' was thrown while evaluating an expression.
Error code 99999, SQL state 42Z23: Attempt to modify an identity column 'EXPENDITURE_ID'.
Line 4, column 1
Execution finished after 0.003 s, 1 error(s) occurred.
//下面的代碼來創建表
create table Expenditure (
Expenditure_ID integer not null primary key generated always as identity (start with 1,increment by 1),
Expenditure_Description varchar (75) not null,
Expense double not null,
Expense_Date date not null
);
現在我沒有在java中的專家,但我不知道是否有人打電話幫我這個。我會很感激。謝謝