java - SQLException error -
i made odbc connection, still wont work.
kindly guide along way, please , thank you
here code below:
package payrollapplication; import java.sql.*; import javax.swing.*; /** * * @author admin */ public class dbconnection { boolean isconn=false; boolean issucc=false; boolean isconfirm=false; private string nextnumber=""; connection conn; preparedstatement ps; resultset rs; statement st; /** creates new instance of dbconnection */ public dbconnection() { connecttodatabase(); } public boolean connecttodatabase() { try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); conn=drivermanager.getconnection("jdbc:odbc:employee"); isconn=true; } catch(exception ex) { joptionpane.showmessagedialog(null,ex,"connection",joptionpane.error_message); } return isconn; } public string getnumber() { return nextnumber; } public void setnumber(string nxtno) { int n; n=integer.parseint(nxtno)+1; nextnumber="" + n + ""; } public void loadempno() { string sqlmax; try { sqlmax="select max(emp_no) ms_employee"; st=conn.createstatement(); rs=st.executequery(sqlmax); if (rs.next()) { setnumber(rs.getstring(1)); } } catch(exception ex) { } } public boolean findemployee(string sqlfind) { try { st=conn.createstatement(); rs=st.executequery(sqlfind); if (rs.next()) { isconfirm=true; } else { isconfirm=false; } } catch(exception ex) { isconfirm=false; } return isconfirm; } public boolean add_update_empmaster(string sql,boolean isadd_or_update) { try { ps=conn.preparestatement(sql); ps.executeupdate(); issucc=true; } catch(exception ex) { // joptionpane.showmessagedialog(null,ex,"connection",joptionpane.error_message); issucc=false; } return issucc; } }
this error popped up:
java.sql.sqlexception: [microsoft][odbc driver manager] specified dsn contains architecture mismatch between driver , application
you need 64-bit drivers if java 64-bit.
Comments
Post a Comment