Dean_Reedy
asked on
JDBC MS Acess connect DSN-less free
-Just getting started in java, and I want to connect my application to a MS access database.
-I would like to be able to connect without using a DSN, thus DSN-less.
- And from what I read all of the drivers cost money, but I would like something free!
Any ideas?
Code & drivers is what I am looking for.
Thanks,
-I would like to be able to connect without using a DSN, thus DSN-less.
- And from what I read all of the drivers cost money, but I would like something free!
Any ideas?
Code & drivers is what I am looking for.
Thanks,
It still needs a DSN.
How can I use the JDBC API to access a desktop database like Microsoft Access over the network?
Most desktop databases currently require a JDBC solution that uses ODBC underneath.
This is because the vendors of these database products haven't implemented all-Java JDBC drivers.
The best approach is to use a commercial JDBC driver that supports ODBC and the database you
want to use. See the JDBC drivers page for a list of available JDBC drivers.
The JDBC-ODBC bridge from Sun's Java Software does not provide network access to desktop databases
by itself. The JDBC-ODBC bridge loads ODBC as a local DLL, and typical ODBC drivers for desktop databases
like Access aren't networked. The JDBC-ODBC bridge can be used together with the RMI-JDBC bridge ,
however, to access a desktop database like Access over the net. This RMI-JDBC-ODBC solution is free.
http://dyade.inrialpes.fr/mediation/download/
also look
http://java.sun.com/products/jdk/1.1/docs/guide/jdbc/index.html
http://java.sun.com/docs/books/jdbc/intro.html
Java how-to DB section!
http://tactika.com/realhome/javaht/java-d1.html
http://codeguru.developer.com/java/Miscellaneous/Database/index.shtml
courtesy: vladi21
Most desktop databases currently require a JDBC solution that uses ODBC underneath.
This is because the vendors of these database products haven't implemented all-Java JDBC drivers.
The best approach is to use a commercial JDBC driver that supports ODBC and the database you
want to use. See the JDBC drivers page for a list of available JDBC drivers.
The JDBC-ODBC bridge from Sun's Java Software does not provide network access to desktop databases
by itself. The JDBC-ODBC bridge loads ODBC as a local DLL, and typical ODBC drivers for desktop databases
like Access aren't networked. The JDBC-ODBC bridge can be used together with the RMI-JDBC bridge ,
however, to access a desktop database like Access over the net. This RMI-JDBC-ODBC solution is free.
http://dyade.inrialpes.fr/mediation/download/
also look
http://java.sun.com/products/jdk/1.1/docs/guide/jdbc/index.html
http://java.sun.com/docs/books/jdbc/intro.html
Java how-to DB section!
http://tactika.com/realhome/javaht/java-d1.html
http://codeguru.developer.com/java/Miscellaneous/Database/index.shtml
courtesy: vladi21
sorry. Ignore my comments. It is the same old link (object web) :)
ASKER
steeks,
I do thank you for the answer, however I am looking for a DSN-less connection option.
The MS Access database will be on my local machine, and in the future I am looking at moving it to a drive mapped to a local server.
Dean
I do thank you for the answer, however I am looking for a DSN-less connection option.
The MS Access database will be on my local machine, and in the future I am looking at moving it to a drive mapped to a local server.
Dean
Comments:
using access, what about Jet Database Engine (ie, MS access db, with the ODBC bridge).
And why not use a DSN? its just a simple matter of a constant in your code, and a registry key on either a local box or a server?
DB's like Oracle allow specification of a port, server name eg db1.muckingfuddled.com:152 1, this is accomplished via a level 4 jdbc driver implmeneted using Sockets.
GR.
using access, what about Jet Database Engine (ie, MS access db, with the ODBC bridge).
And why not use a DSN? its just a simple matter of a constant in your code, and a registry key on either a local box or a server?
DB's like Oracle allow specification of a port, server name eg db1.muckingfuddled.com:152
GR.
ASKER
GR,
True, the DSN route is a possibility. However I want to distribute this simple application to other people, and that would require them to setup a DSN as well, which I am hopping to avoid. Now is there a way to programmable to setup up the DSN?
Dean
True, the DSN route is a possibility. However I want to distribute this simple application to other people, and that would require them to setup a DSN as well, which I am hopping to avoid. Now is there a way to programmable to setup up the DSN?
Dean
The DSN's are just registry entries, they can be added from a batch file and a .reg file.
If you add a DSN to your system, then export the registry key: HKEY_LOCAL_MACHINE\SOFTWAR E\ODBC\ODB C.INI\{DSN _NAME_YOU_ SPECIFY}
for example one on my machine, is one called pimtest (for access), looks like:
[HKEY_LOCAL_MACHINE\SOFTWA RE\ODBC\OD BC.INI\pim test]
"Driver"="C:\\WINNT\\Syste m32\\odbcj t32.dll"
"DBQ"="X:\\FORGE\\pimtest. mdb"
"DriverId"=dword:00000019
"FIL"="MS Access;"
"PWD"="pass"
"SafeTransactions"=dword:0 0000000
"UID"="user"
[HKEY_LOCAL_MACHINE\SOFTWA RE\ODBC\OD BC.INI\pim test\Engin es]
[HKEY_LOCAL_MACHINE\SOFTWA RE\ODBC\OD BC.INI\pim test\Engin es\Jet]
"ImplicitCommitSync"=""
"MaxBufferSize"=dword:0000 0800
"PageTimeout"=dword:000000 05
"Threads"=dword:00000003
"UserCommitSync"="Yes"
GR.
If you add a DSN to your system, then export the registry key: HKEY_LOCAL_MACHINE\SOFTWAR
for example one on my machine, is one called pimtest (for access), looks like:
[HKEY_LOCAL_MACHINE\SOFTWA
"Driver"="C:\\WINNT\\Syste
"DBQ"="X:\\FORGE\\pimtest.
"DriverId"=dword:00000019
"FIL"="MS Access;"
"PWD"="pass"
"SafeTransactions"=dword:0
"UID"="user"
[HKEY_LOCAL_MACHINE\SOFTWA
[HKEY_LOCAL_MACHINE\SOFTWA
"ImplicitCommitSync"=""
"MaxBufferSize"=dword:0000
"PageTimeout"=dword:000000
"Threads"=dword:00000003
"UserCommitSync"="Yes"
GR.
i cant remember exactly, but there is a switch for regedit so in a batch file calling:
regedit /[SomeSwitchOrOther] dsn.reg
will import the require file. (or you could just double click it from explorer, but wheres the fun in that... ;-)
Without a switch it asks if you want to proceed, there is away roundit,m i jsut cant think of hte switch...
GR.
regedit /[SomeSwitchOrOther] dsn.reg
will import the require file. (or you could just double click it from explorer, but wheres the fun in that... ;-)
Without a switch it asks if you want to proceed, there is away roundit,m i jsut cant think of hte switch...
GR.
Are the database's you are trying to access installed on the client?
You only need to setup a DSN on the server hosting the database, not every client.
You only need to setup a DSN on the server hosting the database, not every client.
ASKER
objects,
The program is going to be first on individual clients, however in the future I would like to set it up on the client machines where they are mapping a drive to an NT Server. I prefer DSN-less, or a way programmicly to setup DSNs on the client machines would be answer also.
Dean
The program is going to be first on individual clients, however in the future I would like to set it up on the client machines where they are mapping a drive to an NT Server. I prefer DSN-less, or a way programmicly to setup DSNs on the client machines would be answer also.
Dean
registry programaticlly is either using a "Java" library written by M$ for win32 interaction (i know things like dialogs and directx have been written by M$ so assume there are classes for the registry too), or a native dll/exe with the registry data in, or a .reg file.
> up on the client machines where they are mapping a drive to an NT Server
Then you only need a DSN on the NT server.
Not the client.
Then you only need a DSN on the NT server.
Not the client.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is what I finally got to work. Notice I had to add "newInstance()".
Thanks, guid way.
Class.forName("sun.jdbc.od bc.JdbcOdb cDriver"). newInstanc e();
Connection conn = DriverManager.getConnectio n("jdbc:od bc:;DRIVER =Microsoft Access Driver (*.mdb);DBQ=Test.mdb;PWD=m ypass","lo gin","pass word");
Statement command = conn.createStatement();
ResultSet rs = command.executeQuery("sele ct count(*) as tot from Member");
Thanks, guid way.
Class.forName("sun.jdbc.od
Connection conn = DriverManager.getConnectio
Statement command = conn.createStatement();
ResultSet rs = command.executeQuery("sele
ASKER
Here is what I finally got to work. Notice I had to add "newInstance()".
Thanks, guid way.
Class.forName("sun.jdbc.od bc.JdbcOdb cDriver"). newInstanc e();
Connection conn = DriverManager.getConnectio n("jdbc:od bc:;DRIVER =Microsoft Access Driver (*.mdb);DBQ=Test.mdb;PWD=m ypass","lo gin","pass word");
Statement command = conn.createStatement();
ResultSet rs = command.executeQuery("sele ct count(*) as tot from Member");
Thanks, guid way.
Class.forName("sun.jdbc.od
Connection conn = DriverManager.getConnectio
Statement command = conn.createStatement();
ResultSet rs = command.executeQuery("sele
I thought you knew how to connect, but were confused about DSN's ????
Good to hear your happy :)
Good to hear your happy :)
http://www.objectweb.org/RmiJdbc/RmiJdbcHomePage.htm
You can connect using either a url, hostname, or ip address
This driver is open source, and they provide some useful info for getting it up and running