How to convert CSV into Database Table?

CSV file:

COL1;COL2;COL3
1;2.1;a
2;2.2;b
3;2.3;c

the first line will be the column names, the rest of the data will be the content.

1. recognize data type

2. get table columns

3. create "create table" sql

4. execute it

5.create "Insert" sql, use prepareStatement. Therefore, setXXX should be adjusted by data type.

6. execute them all


發佈了222 篇原創文章 · 獲贊 7 · 訪問量 33萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章