Mat Nadrofsky
Mat Nadrofsky

Reputation: 8264

Bulk load data into sqlite?

Does anybody have any tips on utilities that can be used to bulk load data that is stored in delimited text files into an SQLite database?

Ideally something that can be called as a stand-alone program from a script etc.

A group I work with has an Oracle Database that's going to dump a bunch of data out to file and then load that data into an SQLite database for use on a mobile device and are looking for the easiest way to implement that sort of scenario.

Upvotes: 43

Views: 29057

Answers (2)

Martin Beckett
Martin Beckett

Reputation: 96109

Check out the sqite .import command - it does exacty this.
You can set the separator with the .separator command

sqlite3 myDatabase
create table myTable (a, b, c);
.separator ','
.import  myFile  myTable

Upvotes: 74

Tometzky
Tometzky

Reputation: 23890

Why do you want a text file?

Just use Java which does have easily available libraries for Oracle and SQLite access. Connect to both databases and just select from one db and insert into another with no additional complexity of CSV, which is not a very well defined format and will give you problems with character encoding, quotes, comas/tabs or semicolons, newlines etc. in your data.

Upvotes: 1

Related Questions