exception thrown when reaches execute() or executeUpdate().
passed all parameters as not null - no luck.
java.lang.NullPointerException
at net.ucanaccess.commands.InsertCommand.persist(InsertCommand.java:153)
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:315)
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:205)
at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:161)
at net.ucanaccess.jdbc.Execute.execute(Execute.java:46)
at net.ucanaccess.jdbc.UcanaccessPreparedStatement.execute(UcanaccessPreparedStatement.java:228)
at net.ucanaccess.jdbc.UcanaccessCallableStatement.execute(UcanaccessCallableStatement.java:633)
at Main.addEmployee(Main.java:103)
at FrmEmployees.btnSaveOnClick(FrmEmployees.java:498)
at FrmEmployees.access$800(FrmEmployees.java:7)
at FrmEmployees$9.actionPerformed(FrmEmployees.java:234)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.7 null
at net.ucanaccess.jdbc.UcanaccessPreparedStatement.execute(UcanaccessPreparedStatement.java:230)
at net.ucanaccess.jdbc.UcanaccessCallableStatement.execute(UcanaccessCallableStatement.java:633)
at Main.addEmployee(Main.java:103)
at FrmEmployees.btnSaveOnClick(FrmEmployees.java:498)
at FrmEmployees.access$800(FrmEmployees.java:7)
at FrmEmployees$9.actionPerformed(FrmEmployees.java:234)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Suppressed: java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:397)
at java.util.Timer.schedule(Timer.java:193)
at net.ucanaccess.jdbc.DBReference$MemoryTimer.decrementActiveConnection(DBReference.java:107)
at net.ucanaccess.jdbc.DBReference$MemoryTimer.access$4(DBReference.java:93)
at net.ucanaccess.jdbc.DBReference.decrementActiveConnection(DBReference.java:373)
at net.ucanaccess.jdbc.UcanaccessConnection.close(UcanaccessConnection.java:184)
at Main.addEmployee(Main.java:105)
... 39 more
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.7 null
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:212)
at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:161)
at net.ucanaccess.jdbc.Execute.execute(Execute.java:46)
at net.ucanaccess.jdbc.UcanaccessPreparedStatement.execute(UcanaccessPreparedStatement.java:228)
... 41 more
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.7 null
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:348)
at net.ucanaccess.jdbc.UcanaccessConnection.commit(UcanaccessConnection.java:205)
... 44 more
Caused by: java.lang.NullPointerException
at net.ucanaccess.commands.InsertCommand.persist(InsertCommand.java:153)
at net.ucanaccess.jdbc.UcanaccessConnection.flushIO(UcanaccessConnection.java:315)
... 45 more
thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a 13th attachment field (that was not mentioned in the query) was causing this. upon it's removal from the table in the accdb file, everything works.
so my question is this:
how do you set an actual attachment type parameter into the statement? what setX method do you use?
how do you setNull an attachment type parameter? what java.sql.Types do you use?
thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you're asking how to manipulate Attachments from a saved query in Access (that could in turn be invoked by a CallableStatement in Java), I'm not sure it's even possible. The Access Database Engine tends to throw errors like "An INSERT INTO query cannot contain a multi-valued field." whenever we try to run DML statements that include "complex" fields (i.e., fields that can have more then one value, like an Attachment field or a multi-value Lookup field).
However, if you're asking how to insert Attachments using a PreparedStatement then you have to use setObject to pass an array of net.ucanaccess.complex.Attachment objects.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hey guys,
been having this issue.. exception is thrown, but record is still added to table.
have a strong feeling it's not on my end. didn't have this issue in previous build.
ordinary "INSERT INTO (...) VALUES (...) query with parameters stored as qryInsEmployee on accdb:
java method:
(similar method for update query doesn't have any issues).
exception thrown when reaches execute() or executeUpdate().
passed all parameters as not null - no luck.
thanks!
I am unable to recreate your issue under UCanAccess 3.0.7 using the attached database file and the following code:
It would be helpful if you could post a small sample database file that could be used to reliably recreate the issue.
Hey Gord,
a 13th attachment field (that was not mentioned in the query) was causing this. upon it's removal from the table in the accdb file, everything works.
so my question is this:
how do you set an actual attachment type parameter into the statement? what setX method do you use?
how do you setNull an attachment type parameter? what java.sql.Types do you use?
thanks!
If you're asking how to manipulate Attachments from a saved query in Access (that could in turn be invoked by a
CallableStatement
in Java), I'm not sure it's even possible. The Access Database Engine tends to throw errors like "An INSERT INTO query cannot contain a multi-valued field." whenever we try to run DML statements that include "complex" fields (i.e., fields that can have more then one value, like an Attachment field or a multi-value Lookup field).However, if you're asking how to insert Attachments using a
PreparedStatement
then you have to usesetObject
to pass an array ofnet.ucanaccess.complex.Attachment
objects.