-
JDBC & Connection
Hi All,
I have been asked to create a program to process a number Excel files. I have been able to make a ODBC connection to a test Excel file, and this works a treat. However I do not want to force my client to go into ODBC and point it at a different Excel file for every one that he has to process.
Is there a way within code to point JDBC at an Excel file of interest? I can provide a means to my client to indicate which Excel file they wish to process, but getting the code to open an Excel file without a predefined ODBC connection is the challenge.
Any thoughts or suggestions would be greatly appreciated.
James Davidson.
-
-
So I can't point JDBC to an Excel file as I could with MS ADO & ADO.Net? That doesn't sound right.
James Davidson
-
Change the typical Database URL path from:
static final String DATABASE_URL = "jdbc dbc:Excel Files";
(where the Excel Files is the DSN that you create to point to a single Excel File)
To:
public static final String DATABASE_URL = "jdbc dbc river={Microsoft Excel Driver (*.xls)};DBQ=c:\\Java\\EXCELJDBCTest.xls;DriverID=22;READONLY=false";
obviously, change your C:\\Path to suit your needs.
This will solve the ODBC problem.
Cheers!
James
-
to sort of answer the why and not the how (since JamesD did so well):
The DB in ODBC and JDBC is database. Excel is not a database and really should not be a repository for Data.
Excel is a proprietary tool and so is the storage format. Since, IMHO, many people use the wrong medium - vendors, opensource developers, etc. have come up with ways to get them out of their jam.
Since Excel and ADO are both from MS it would stand to reason that they would work together (although oddly enough this is not always true with Microsoft Software).
BTW, just noticed that the software I linked to is GPL so be careful how you use it. Since it is a driver, you should be fine.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks