This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC That fails in one workspace but works in another

 
Alejandro Barrero
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this problem in Eclipse and MyEclipse. I create the connection with
public Connection getConnection() throws SQLException {
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String fullConnectionString = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ="
+ filePath;
Connection conn = null;
try {
Class.forName(driver);
conn = DriverManager.getConnection(fullConnectionString, userName,
password);
} catch (ClassNotFoundException cnfe) {
throw new SQLException("ClassNotFoundException");
} catch (SQLException e) {
throw new SQLException("SQLException");
}
return conn;
}
} // Sorry, but using the code option was giving me problems
The exact problem is that I get the error "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"; for some reason JDBC is working different in the worspaces.
I am absolutely puzzled. The code stopped working in a workspace, but when I tried it in another workspace it worked.
 
Alejandro Barrero
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RESOLVED-SORT OF
I solved the problem by creating a project with the same code in a new workspace.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's good.

Also, I logged the code tag problem as a bug in our system. This shouldn't be happening!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic