views:

279

answers:

1

Hi,

I'm looking for a way to open an Access MDB file inside a Java App (using JDBC).

A quick Google Search suggests that I need the JDBC-ODBC Bridge for this...

Does this mean that I need to configure every system I want to run my app on to provide a ODBC DSN for the MDB I want to open?

And one more question (since I've never used ODBC before): will the communication happen over some sort of a socket (in a client/server-style), or through method/function calls (like with an embeded Derby db)?

+5  A: 

1) You won't need to configure every system with a SYSTEM or USER ODBC DSN to access the MDB you want. You can still provide all the information you need in your JDBC URL:

jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/yourdb.mdb

But keep in mind that the system will need to have the driver you are using installed.

2) The communication will happen the way your ODBC driver communicates. If it opens a socket to the server (the way an Oracle ODBC connection takes place) it will open a socket. If it uses library function calls, it will communicate through library function calls.

JDBC to ODBC communication uses JNI to communicate.

Pablo Santa Cruz
ok the code would be windows-only then...thank you!
Buttercup
I guess you could have a JDBC proxy driver. That is to say a JDBC driver that connects over a socket to another Java process which then executes the calls on a real JDBC driver (JDBC-ODBC bridge). I think such things exist for JDBC, OBDC and UDBC.
Tom Hawtin - tackline
@Buttercup: The specific code I posted is Windows only. But you can still use JDBC-ODBC bridge under Linux (provided you have ODBC installed, of course).
Pablo Santa Cruz
@Tin Hawtin: I think what you are referring to are JDBC Type 3 (middleware) drivers.
Pablo Santa Cruz