Microsoft Access DB Driver for JDBC

J

Jsnail

Does any body know of any freeware ms access drivers for jdbc that
allow direct access to an ms access db. The jdbc odbc bridge works but
i dont know how to dynamically add odbc data connections in windows
(Some code to do this would also help).
 
L

Lee Fesperman

Jsnail said:
Does any body know of any freeware ms access drivers for jdbc that
allow direct access to an ms access db. The jdbc odbc bridge works but
i dont know how to dynamically add odbc data connections in windows
(Some code to do this would also help).

There is no JDBC driver for Access.

The only way to add ODBC datasources in Java is to use JNI.

You need to get a better db.
 
J

James Croft

Jsnail said:
Does any body know of any freeware ms access drivers for jdbc that
allow direct access to an ms access db. The jdbc odbc bridge works but
i dont know how to dynamically add odbc data connections in windows
(Some code to do this would also help).

I don't know of any classes for manipulating the registry (I'm new to
Java). But I've created DSNs on the fly with C# by manipulating the
registry keys under:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC

If you can find a Java class for registry manipulation coding this is
straight forward enough. Create a DSN manually and take a look at the
changes under that reg key.

HTH

James
 
T

Thomas Kellerer

I don't know of any classes for manipulating the registry (I'm new to
Java). But I've created DSNs on the fly with C# by manipulating the
registry keys under:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC

If you can find a Java class for registry manipulation coding this is
straight forward enough. Create a DSN manually and take a look at the
changes under that reg key.

You don't need a DSN for accessing Access DBs (or other ODBC connections).
Google for "DSN less connection java"

http://www.google.com/search?hl=en&q=dsn+less+connection+odbc+java&btnG=Google+Search

Thomas
 
J

James Croft

Lee said:
There is no JDBC driver for Access.


The JDBC-ODBC bridge is intended (dunno, never used it although the
poster says it works) to allow Java apps to talk to any ODBC datasource.

http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/bridge.doc.html

The only way to add ODBC datasources in Java is to use JNI.

Security issues aside wouldn't it be possible to create a temporary .reg
file with the changes needed and call 'regedit myupdate.reg' using Javas
Runtime.exec() function?

As I said before I'm fairly new to Java so have no idea if its security
features will block this. If it worked it'd be easier than JNI.

You need to get a better db.

As ghastly as Access is to real men who drink real beer and use real
databases there may be a perfectly valid reason for using it, eg. the
boss/client demanding that it be used.

Cheers,

James
 
J

James Croft

Thomas said:
You don't need a DSN for accessing Access DBs (or other ODBC connections).
Google for "DSN less connection java"

http://www.google.com/search?hl=en&q=dsn+less+connection+odbc+java&btnG=Google+Search

Thomas

I guess how the Access DB is to be used will decide if this is useful or
not. AFAIK (let me know if this is wrong) DSNs allow multiple
connections/updates without the file locking issues a individual
processes trying to get the file open for writing would have.

James
 
J

Jsnail

no i'm a student and the ms sql server database is regarded the holy
grail around here
 
J

Josef Garvi

Jsnail said:
Does any body know of any freeware ms access drivers for jdbc that
allow direct access to an ms access db. The jdbc odbc bridge works but
i dont know how to dynamically add odbc data connections in windows
(Some code to do this would also help).

I simply specify the path to the Access db in my connection string.

Example:
String dbUrl = "jdbc:eek:dbc:MS Access Database;DBQ=C:\\MyFolder\\myDb.mdb;"
Connection con = DriverManager.getConnection(dbUrl, "", "");


PS. This discussion seems more appropriate for the databases ng, so I've
pointed the follow-up there.

--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty
 
L

Lee Fesperman

James said:
The JDBC-ODBC bridge is intended (dunno, never used it although the
poster says it works) to allow Java apps to talk to any ODBC datasource.

Well, the OP mentioned the JDBC-ODBC bridge, so it was obvious that he was looking for a
'native' JDBC driver for Access.
Security issues aside wouldn't it be possible to create a temporary .reg
file with the changes needed and call 'regedit myupdate.reg' using Javas
Runtime.exec() function?

As I said before I'm fairly new to Java so have no idea if its security
features will block this. If it worked it'd be easier than JNI.

Java security might block exec() but doesn't care what you execute with it.
As ghastly as Access is to real men who drink real beer and use real
databases there may be a perfectly valid reason for using it, eg. the
boss/client demanding that it be used.

I'll leave it to the OP to clarify that, but I was giving very good advice in general
.... and not just because of JDBC-ODBC problems.
 
L

Lee Fesperman

Jsnail said:
no i'm a student and the ms sql server database is regarded the holy
grail around here

Then, why were you asking about Access? Are you an atheist around there?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,823
Latest member
Nadia88

Latest Threads

Top