• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JdbcOdbc bridge direct access method

 
Bill Warner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does the following code seem to work on some machines (PC's) and not others?

public Connection getConnection(){
try {
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//String dataSourceName = "IssuanceTracker";
//String dbURL = "jdbc dbc:IssuanceTracker";// + dataSourceName;
//Connection con = DriverManager.getConnection(dbURL, "","");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "c:/IssuanceTracker/IssuanceTracker.mdb";
String database = "jdbc dbc river={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim();
System.out.println(database);
Connection con = DriverManager.getConnection( database ,"","");
return con;
}
catch (Exception e) {
System.out.println("Error: " + e);
e.printStackTrace();
return null;
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic