File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes creating a DSN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "creating a DSN" Watch "creating a DSN" New topic

creating a DSN

Daniel Salzer

Joined: Dec 19, 2003
Posts: 8
I want to read data from a number of excel spreadsheets in a folder. However, I need to create the dsn dynamically through the Java code - anybody knows how to do that ? There should be a cmd line, right ?



Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32820

The DSN typically contains the driver and file name, right? The driver should be known in advance. And the file name, you can pass in at runtime. Concatenate these and you have the DSN. I may be missing the point here though.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Hareesh Ram Chanchali
Ranch Hand

Joined: Jan 31, 2005
Posts: 110

first, DSN u can get thru ...Control Panel>Administrative tools>Data Resources ...Here u can create a new DSN of type u want...(sometimes require user name and password)

secondly, using jdbc-odbc dsn for reading excel files mayt not be that much efficient...

so try to go for oracle thin driver...supports all that needed for reading excel

Hareesh Ram Chanchali
SCJP 5.0, IBM Certified Solution Designer
Andrew Eccleston
Ranch Hand

Joined: Jul 07, 2004
Posts: 140
If I understand what you are looking for, I've been doing this with Access files. The URL is a bit different than normal:

I haven't tested this with Excel, but I think it would be:

Since it's just a string being passed in, you can build that programmatically before passing it in.


[ February 14, 2005: Message edited by: Andrew Eccleston ]

The statement below is true.<br />-------------------------------<br />The statement above is false.
Hareesh Ram Chanchali
Ranch Hand

Joined: Jan 31, 2005
Posts: 110

we do have problems in using such type of driver tosuch applications
you also verify..I do not think it can do all that you want
I agree. Here's the link:
subject: creating a DSN
It's not a secret anymore!