Java DB CSV Import Wiki
Java tool to import db data from csv, json or xml files
Brought to you by:
hudeany
Usage: java -jar DbCsvImport.jar [-gui] [optional parameters] dbtype hostname[:port] username dbname tablename importfilepath [password]
Simple usage: java -jar DbCsvImport.jar dbtype hostname username dbname tablename importfilepath
dbtype: mysql | oracle | postgresql | firebird | sqlite | derby | hsql
hostname: with optional port (not needed for sqlite and derby)
username: username (not needed for sqlite and derby)
dbname: dbname or filepath for sqlite db or derby db
tablename: table to import to
importfilepath: file to import, maybe zipped (.zip)
password: is asked interactivly, if not given as parameter (not needed for sqlite and derby)
-x importDataFormat: Data import format, default format is CSV
importDataFormat: CSV | JSON | XML | SQL
-m: column mappings (separated by semicolon or linebreak): when not configured a simple mapping by column names is used
Mapping entry format: dbcolumnname=\"data column name\" <formatinfo>
<formatinfo> may be decimal delimiter (default .), date pattern (default dd.MM.yyyy HH:mm:ss) or file
Example: 'db1=\"def 1\" ,;db2=\"def 2\" .;db3=\"def 3\" dd.MM.yyyy HH:mm:ss;db4=\"def 4\" file'
-mf: column mapping file, containing the mapping entries of -m
-n 'NULL': set a string for null values (only for csv and xml, default is '')
-l: log import information in .log files
-v: progress and e.t.a. import in terminal
-e: encoding for CSV and JSON data files and clob files (default UTF-8)
-s: separator character, default ';', encapsulate by '
-q: string quote character, default '\"', encapsulate by '
-noheaders: first csv line is data and not headers
-c: complete commit only (takes more time and makes rollback on any error)
-a: allow underfilled lines
-t: trim data values
-i 'importmode': importmodes: CLEARINSERT | INSERT | UPDATE | UPSERT
-u: don't update with null values from import data
-k 'keycolumnslist': keycolumns list comma separated
-insvalues 'valuelist': value list semicolon separated: Sometimes values not included in the data file are needed for inserts. E.g.: id=test_seq.NEXTVAL;flag='abc'
-updvalues 'valuelist': value list semicolon separated: Sometimes values not included in the data file are needed for updates. E.g.: create=current_timestamp;flag='abc'
-create: scan data and create suitable table, if not exists
-logerrors: log error data items in file
-help: show this help manual
-gui: open a GUI
-version: show current local version of this tool
-update: check for online update and ask, whether an available update shell be installed