how to connect to excel database residing on a different machine ?
Joined: Sep 17, 2001
Hi All, Can anyone explain me with java code how to connect to a excel database residing on a different(I know that we do it thro' dsn) in my network . Also, I am doing a website where some pages of website are jsp, servlets. I want to implement a search functionality in my site so that if the user types a keyword then I need to show him the links to the pages(whether jsp,html) which contain this keyword. How do I do that other than using property files .
Well, the second half of your question regarding JSP/Servlets would probably be better answered in a seperate forum. There is a forum for JSP and a forum for Servlets. I would suggest posting that part of your question in the JSP forum. As for your JDBC question, I am going to assume that you mean an Access Database, not an Excel database, since Excel is a spreadsheet application. (Though the underlying funtion is probably the same between Access and Excel). Yes, you typically have to use DNS entries to comunicate with an Access Databse. I have seen Drivers that use a DNSless connection, but it is not supported everywhere. As far as connecting to an Access Database on a seperate machine, in both cases stated above, you would have to have a physical drive mapped to the PC where the database resides. Is there any reason you are using Access instead of something like MySQL? I would suggest staying as far away from Access as possible. BTW - There is a naming policy here at Javaranch. A moderator will probably let you know about it unless you go ahead and change your name to adhere to that policy. Just giving you a heads up. [ February 15, 2003: Message edited by: Gregg Bolinger ]
Joined: May 05, 2000
The easiest way is to set up an ODBC connection to the Excel doc and then use the JDBC-ODBC bridge.
I've done this quite happily when the spreadsheet is on the same Windows machine as the JDBC code to use it: Set up a DSN from the control panel, refer to it from the JDBC-ODBC bridge. But I've never managed to refer to either an Access database or an Excel spreadsheet through JDBC, when the data resides on a different machine. On one where I don't have access to the control panel (such as a shared server), I wouldn't even know where to start. Can anyone who has done this offer any suggestions or hints if there is something obvious missing here?