This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes creating a DSN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "creating a DSN" Watch "creating a DSN" New topic
Author

creating a DSN

Daniel Salzer
Greenhorn

Joined: Dec 19, 2003
Posts: 8
Hello,
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 ?

Thanks

Daniel


Daniel
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Daniel,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Hareesh Ram Chanchali
Ranch Hand

Joined: Jan 31, 2005
Posts: 110
hi,

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.

HTH,

andrew
[ 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
hi,

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

http://www.javaworld.com/javaworld/javaqa/2001-06/04-qa-0629-excel.html
 
 
subject: creating a DSN