mysql - Java program connect to access database -
i have java program connects external microsoft access database. following shows code in databasehandler class, used connect database.
static public int makeconnectiontofireplacedb() { try { // make connection database connectiontofireplacedb = drivermanager.getconnection("jdbc:odbc:fireplace"); } catch (sqlexception exception) { return (-1); // return -1 if there problem // making connection } return (0); // return 0 if connection made database } // end
the follow shows part of code class of program uses external database. class views data database (which @ bottom of code isn't necessary question). when try access database following error: unable connect database table fireplace.
if ( databasehandler.loaddriver() == -1 ) { joptionpane.showmessagedialog (frame, "problem loading jdbc/odbc driver."); // check see if can connect database table } else if ( databasehandler.makeconnectiontofireplacedb() == -1 ) { joptionpane.showmessagedialog (frame, "unable connect database table fireplace"); } else { // search fireplaces // ...show data
so cannot connected external database, appreciated.
update: following error:
java.sql.sqlexception: [microsoft][odbc driver manager] specified dsn contains architecture mismatch between driver , application
Comments
Post a Comment