JDBC & Connection


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: JDBC & Connection

  1. #1
    Join Date
    Feb 2004
    Posts
    31

    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.

  2. #2
    Join Date
    Jun 2004
    Posts
    199

  3. #3
    Join Date
    Feb 2004
    Posts
    31
    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

  4. #4
    Join Date
    Sep 2004
    Posts
    1
    Change the typical Database URL path from:
    static final String DATABASE_URL = "jdbcdbc: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 = "jdbcdbcriver={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

  5. #5
    Join Date
    Jun 2004
    Posts
    199
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center