File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes JDBC That fails in one workspace but works in another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC That fails in one workspace but works in another" Watch "JDBC That fails in one workspace but works in another" New topic
Author

JDBC That fails in one workspace but works in another

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 302
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.


Your help will be greatly appreciated,
Alejandro Barrero
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 302
RESOLVED-SORT OF
I solved the problem by creating a project with the same code in a new workspace.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

That's good.

Also, I logged the code tag problem as a bug in our system. This shouldn't be happening!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC That fails in one workspace but works in another
 
Similar Threads
HELP please with SQL Server
jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ= stopped working
Creating JAR
connecting to Webtrends reporting DB using JDBC-ODBC
Problem creating a Microsoft Access connection from a file