Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I build a resultset from a file in Java?

I don't have much experience working with resultsets, but as ResultSet is an interface, I guess I could implement it to work with a file as a backend. Is this nonsense? Is there any solution already given for my problem?

like image 397
Doppelganger Avatar asked Apr 08 '10 15:04

Doppelganger


People also ask

Can we use two ResultSet in Java?

A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. So basicly, a Statement can only give you one ResultSet at a time, so you loose the first result when you execute the second query.

How does ResultSet work in Java?

The ResultSet interface provides getter methods ( getBoolean , getLong , and so on) for retrieving column values from the current row. Values can be retrieved using either the index number of the column or the name of the column. In general, using the column index will be more efficient. Columns are numbered from 1.


2 Answers

It seems like there already is a Csv2JDBC project, that may contain at least an example implementation of ResultSet.

like image 95
Riduidel Avatar answered Oct 13 '22 02:10

Riduidel


HSQL also provides support for interpreting csv files as ResultSets.

like image 39
Adamski Avatar answered Oct 13 '22 01:10

Adamski