JDBC + Microsoft Access (*.mdb) File on LINUX
843854Jan 20 2003 — edited May 3 2004Hello All,
I've been trying (unsuccessfully) to access a Microsoft (mdb) file using the JDBC:ODBC bridge on Linux.
This is the code I am using:
import java.sql.*;
import java.util.*;
class test
{
public static void main(String[] args)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// set this to a MS Access DB you have on your machine
String filename = "/home/mpik/java/test.mdb";
String database = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end
Connection con = DriverManager.getConnection(database);
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
I am not sure if what I am trying to do is possible, given that I am running this on a Linux box with no ODBC support for MS-Access.. If this is not possible then how can I access my .mdb file? Can I have a Windows machine with and ODBC driver access the DB and then use JDBC over a network to access the Windows machine?
Alternatively, is there a way to have Oracle tables linked to my mdb file? (I think I can use JDBC to access oracle running on the linux box).
Thanks for any help,
Michael