Jdbc connect to a Plain text file

D

Duke

Hi all,

I've read on Sun's java site that with JDBC 3.0 is actually possible
to use plain text file (such as CSV) as table and make my queries on
that.


"JDBC technology is an API that lets you access virtually any tabular
data source from the Java programming language. It provides cross-DBMS
connectivity to a wide range of SQL databases, and now, with the new
JDBC API, it also provides access to other tabular data sources, such
as spreadsheets or flat files."


How can I do this? I can't find any example for getting the
connection. I don't want to use third party drivers.... if not
absolutely necessary.

can you help me??

thanks

Duke
 
S

Sudsy

Duke said:
Hi all,

I've read on Sun's java site that with JDBC 3.0 is actually possible
to use plain text file (such as CSV) as table and make my queries on
that.


"JDBC technology is an API that lets you access virtually any tabular
data source from the Java programming language. It provides cross-DBMS
connectivity to a wide range of SQL databases, and now, with the new
JDBC API, it also provides access to other tabular data sources, such
as spreadsheets or flat files."


How can I do this? I can't find any example for getting the
connection. I don't want to use third party drivers.... if not
absolutely necessary.


Check this out:

<http://sourceforge.net/project/showfiles.php?group_id=17973&release_id=134797>

I've also got some sample code which reads tsv and csv files; contact
me off-line if you'd like a copy.
 
D

Duke

Sudsy said:
Check this out:

<http://sourceforge.net/project/showfiles.php?group_id=17973&release_id=134797>

I've also got some sample code which reads tsv and csv files; contact
me off-line if you'd like a copy.


My question is:

Is there a way to do csv and plain text access with jdbc without the
use of external drivers or odbc?

I've tried the driver you mention, but it's only read-only and I need
both select and insert/update.

With odbc i got all that i need, but I don't like to use it.

From what you read on java's site it seem that with the new jdbc 3.0
you got this opportunity natively, without the use of third party
driver.

Duke
 
M

Michael Borgwardt

Duke said:
Is there a way to do csv and plain text access with jdbc without the
use of external drivers or odbc?

I don't think so. To use JDBC, you need a driver. And so far the only
driver that comes with the JRE is the JDBC-ODBC bridge. In fact, JREs from
vendors other than Sun may not even include that one.

From what you read on java's site it seem that with the new jdbc 3.0
you got this opportunity natively, without the use of third party
driver.

I don't think that is what was meant. The only thing that might contain
such drivers are the standardized RowSet implementations, but these
ssem to be unavailable right now and will be included in SDK 1.5 at
the earliest.
 
S

Sudsy

Michael Borgwardt wrote:

I don't think that is what was meant. The only thing that might contain
such drivers are the standardized RowSet implementations, but these
ssem to be unavailable right now and will be included in SDK 1.5 at
the earliest.

I agree with Michael: the Sun site only suggests that you CAN interface
with csv/tsv files using JDBC drivers. If you follow their links you'll
find them pointing to commercial products, some with prices in the US$
thousands! That's why I dug up the sorceforge solution.
So it comes down to this: spend money on a commercially available
product, write it yourself, pay someone to write it for you, or wait.
The problem as I see it is that there just isn't a great deal of demand
for something like this. Those commercial products bundle the csv/tsv
along with other drivers; it seems like an "added extra", not the core
product.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top