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