sql - Syntax Error Insert Into statement java -


i want add dataset ms acces database. syntax error in sql statements @ executeupdate statement. if me, great.

here can see error:

java.sql.sqlexception: [microsoft][odbc-treiber für microsoft access] syntaxfehler in der insert into-anweisung. @ sun.jdbc.odbc.jdbcodbc.createsqlexception(unknown source) @ sun.jdbc.odbc.jdbcodbc.standarderror(unknown source) @ sun.jdbc.odbc.jdbcodbc.sqlexecute(unknown source) @ sun.jdbc.odbc.jdbcodbcpreparedstatement.execute(unknown source) @ sun.jdbc.odbc.jdbcodbcpreparedstatement.executeupdate(unknown source) @ verwaltung.listenerregistrieren.addbenutzer(listenerregistrieren.java:47) @ verwaltung.listenerregistrieren.actionperformed(listenerregistrieren.java:28) @ javax.swing.abstractbutton.fireactionperformed(unknown source) @ javax.swing.abstractbutton$handler.actionperformed(unknown source) @ javax.swing.defaultbuttonmodel.fireactionperformed(unknown source) @ javax.swing.defaultbuttonmodel.setpressed(unknown source) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(unknown source) @ java.awt.component.processmouseevent(unknown source) @ javax.swing.jcomponent.processmouseevent(unknown source) @ java.awt.component.processevent(unknown source) @ java.awt.container.processevent(unknown source) @ java.awt.component.dispatcheventimpl(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.lightweightdispatcher.retargetmouseevent(unknown source) @ java.awt.lightweightdispatcher.processmouseevent(unknown source) @ java.awt.lightweightdispatcher.dispatchevent(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.window.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$200(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue.dispatchevent(unknown source) @ java.awt.eventdispatchthread.pumponeeventforfilters(unknown source) @ java.awt.eventdispatchthread.pumpeventsforfilter(unknown source) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.run(unknown source) 

and code error based on. in executeupdate() - statement :

try {      class.forname("sun.jdbc.odbc.jdbcodbcdriver");     connection conn = drivermanager.getconnection("jdbc:odbc:msaccess");     preparedstatement pstm;     pstm = conn.preparestatement("insert benutzer (benutzername, vorname, nachname, e-mail) values (?,?,?,?)");      // sql statements     pstm.setstring(1, gui.benutzername.gettext());     pstm.setstring(2, gui.vorname.gettext());     pstm.setstring(3, gui.nachname.gettext());     pstm.setstring(4, gui.email.gettext());     pstm.executeupdate();      } catch (exception e) {         e.printstacktrace();     } 

i can't find syntax error! can me?

thank you

the e-mail column has hyphen in it, should escape it. see answer how : dash in field name in access database table


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -