我开始学习Java并需要一些帮助。我需要将CSV文件导入SQLite数据库。我有这个CSV阅读器,但我不知道如何将这些数据复制到SQLite数据库。将CSV导入Java中的SQLite
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class csv {
public static void main(String[] args) {
String csvFile = "/home/user/user.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
String[] table = line.split(cvsSplitBy);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
[这里](http://stackoverflow.com/questions/25845643/insert-string-into-jdbc-sqlite-database):如何打开一个连接到SQLite数据库并插入记录。 – BackSlash