Question

I need to execute basic queries on a text file which consists of several columns. I tried to use StelsCSV which is a JDBC Driver for CSV files. It is good but commercial. Do you know other tools for the same task?

Was it helpful?

Solution

HSQL has functionality for manipulatng csv data, and it's open source.

OTHER TIPS

Haven't used this but here is one: http://csvjdbc.sourceforge.net/

Also: https://xlsql.dev.java.net/

One option would be to parse the text files and store them in an embedded database like HypersonicDB. Once there, they can be queried using SQL.

How practical this is would depend how often the files change, and how expensive it is to parse and load them. Only you can answer that, but it may be worth considering. For example, if you run frequent queries against the data, it may be worth the up-front cost of loading into the DB, since each query should be more efficient.

Of course, you also get the advantage of using a "proper" supported database.

Do you need to do this as a database driver, or just an easy way to parse a CSV file?

My personal opinion is that JDBC/etc... for this sort of thing is way overkill. If you are good with using a simple reader interface, and having things be lightweight, and 'just work', check out OpenCSV

If you want, you can use MySQL to do the job.

Take a look at:

http://dev.mysql.com/tech-resources/articles/csv-storage-engine.html

Super CVS is a nice library and it is free software.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top