This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JdbcOdbc bridge direct access method  RSS feed

 
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;
}
}
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!