Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java on Linux with .MDB file

843859Apr 15 2009 — edited Apr 16 2009
Hi,

I have created a small java project (experementing actually) to connect to my database .mdb in windows. it works find in my windows environment (Vista + Java + .mdb). I created a .jar file and try to execute it in the Linux (obundu) the program opens but it does not connect to the database instead it throws an error (null),

I am using the DNSless connection. I have attached the code for checking
   Connection getConnection() throws Exception {
    try{
        String dir=System.getProperty("user.dir")+"/db/Client.mdb";
    System.out.println("1");
         Driver d = (Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    System.out.println("2");
         Connection c=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ="+dir, "admin", "pass");
    System.out.println("3");
    return c;
    }
    catch (exception e){
       System.out.println(e.getMessage());
        System.out.println("4");
}
    }
When I run this code in linux (I have included some print statements for debugging purpose) it print 1,2,null,4
but with windows 1,2,3 (which has opened the connection)

could anyone help me with this connection. I have even installed jdk 6 with netbeans in my linux pc to re-compile in linux itself to check. I still get the same error. the programme not connecting to the database

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 14 2009
Added on Apr 15 2009
8 comments
517 views