• 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;
}
}
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!