while trying to import some data from my accessing MS Access 2010 to a mySQL server i receive this error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
below is my code for the connection:
String user = "root"; String pwd = "pass"; String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/newspaper"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String filename = "C:/JUN2011.mdb"; String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="; database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end // now we can get the connection from the DriverManager Connection conn = DriverManager.getConnection( database ,"",""); Class.forName(driver); Connection con = DriverManager.getConnection(url, user, pwd); Statement stmt = con.createStatement(); Statement access=conn.createStatement();
when i run the code in Win XP everything was working perfectly... but once i run it on Win 7.. the error came out..
i am using;
MySQL 5.5 server, MS Access 2010(on Win 7)/MS Access 2003 (Win XP).. my IDE is JCreator Pro 4.5
OS: Window 7 x64bits Ultimate/ Windows XP Pro SP2