- This topic has 7 replies, 2 voices, and was last updated 14 years, 4 months ago by
support-swapna.
-
AuthorPosts
-
I know this is not a J2EE question, but I could not find an appropriate forum. The code is:
public static void main(String[] args) { try { DataSource dataSource = new AccessDataSource( "D:\MyWorkspaces\Eclipse\The Paperless Office\PaperlessOffice.database", 1); Connection conn = dataSource.getConnection(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public Connection getConnection() throws SQLException { String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; String fullConnectionString = "jdbc:odbc:Driver={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"); }
I have in both the same Java compliance, 1.6, and the same jre “C:\Program Files (x86)\Java\jdk1.6.0_20”.
March 6, 2011 at 1:55 pm #315007Sorry. I found that the code that runs in Eclipse is in another project. The code in the same project also fails. I DON’T KNOW HOW TO DELETE THIS POST.
March 6, 2011 at 2:11 pm #315008I need this post to go on. The actual problem is that in MyEclipse, the code runs well in one workspace but fails in another.
March 6, 2011 at 10:21 pm #315012
support-swapnaModeratorhandro1104,
Can you please answer some questions for me to understand the issue?
1) Please share your installation details from MyEclipse > Installation Summary > Installation Details. Paste them here for me.
2) What is the error you see in the workspace in which the code is not working. Clear the error log which is located at < workspace dir>/.metadata/.log . Now switch to the workspace where your code is not working. Run it and check the .log file for any errors of interest. Paste them here for me.
March 7, 2011 at 6:58 am #315019Thank you again for your support. I actually realized that the problem is with Eclipse because the problem also occurs with the same workspace. On the other hand, I solved the problem by by copying the code to a new workspace (haven’t tried with a new project in the same workspace.).
March 8, 2011 at 3:44 am #315058
support-swapnaModeratorhandro1104,
Glad that it is working fine.
Do let us know if you have any other issues.March 8, 2011 at 8:25 am #315065Hi swapna. I hope you remember my problem creating web applications with only a servlet.
March 11, 2011 at 12:35 am #315135
support-swapnaModeratorhandro1104,
Please refer to it here :
https://www.genuitec.com/forums/topic/problem-with-web-applications/#post-315134 -
AuthorPosts