Thread: No Results were returned by the query

No Results were returned by the query

From
"Vitali Petrov"
Date:
I am using PostGreSQL 7.3 with JDBC driver of
http://jdbc.postgresql.org/download/devpgjdbc2.jar.

I use preparedStatement to make query like INSERT INTO table_name VALUES
(?,?,?,?,?,?,?,?)

After executing code I have in my database table row, that programm
inserted, but I also have exception thrown by that programm block.

Exception is:
No results were returned by the query.

    at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:157)

    at rendifirma.RentijadListModel.insertNewItem(RentijadListModel.java:107)

    at
rendifirma.MainFrame.jButtonIR2Salvesta_actionPerformed(MainFrame.java:644)

    at rendifirma.MainFrame$12.actionPerformed(MainFrame.java:315)

    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)

    at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)

    at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)

    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)

    at
javax.swing.plaf.basic.BasicRootPaneUI$DefaultAction.actionPerformed(BasicRootPaneUI.java:156)

    at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1384)

    at javax.swing.JComponent.processKeyBinding(JComponent.java:2078)

    at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:252)

    at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:205)

    at
javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2145)

    at javax.swing.JComponent.processKeyBindings(JComponent.java:2138)

    at javax.swing.JComponent.processKeyEvent(JComponent.java:2045)

    at java.awt.Component.processEvent(Component.java:3553)

    at java.awt.Container.processEvent(Container.java:1164)

    at java.awt.Component.dispatchEventImpl(Component.java:2593)

    at java.awt.Container.dispatchEventImpl(Container.java:1213)

    at java.awt.Component.dispatchEvent(Component.java:2497)

    at java.awt.LightweightDispatcher.processKeyEvent(Container.java:2155)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2135)

    at java.awt.Container.dispatchEventImpl(Container.java:1200)

    at java.awt.Window.dispatchEventImpl(Window.java:914)

    at java.awt.Component.dispatchEvent(Component.java:2497)

    at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)

    at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)

    at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

Question is :
Why i got that exception from this line of code:
  ResultSet rs_tmp = newItemPStat.executeQuery();


Thanks.






_________________________________________________________________
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail


Re: No Results were returned by the query

From
Dave Cramer
Date:
Yes, you need to use Statement.executeUpdate to do inserts.

Dave
On Fri, 2003-01-17 at 09:02, Vitali Petrov wrote:
> I am using PostGreSQL 7.3 with JDBC driver of
> http://jdbc.postgresql.org/download/devpgjdbc2.jar.
>
> I use preparedStatement to make query like INSERT INTO table_name VALUES
> (?,?,?,?,?,?,?,?)
>
> After executing code I have in my database table row, that programm
> inserted, but I also have exception thrown by that programm block.
>
> Exception is:
> No results were returned by the query.
>
>     at
> org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:157)
>
>     at rendifirma.RentijadListModel.insertNewItem(RentijadListModel.java:107)
>
>     at
> rendifirma.MainFrame.jButtonIR2Salvesta_actionPerformed(MainFrame.java:644)
>
>     at rendifirma.MainFrame$12.actionPerformed(MainFrame.java:315)
>
>     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
>
>     at
> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
>
>     at
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
>
>     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
>
>     at
> javax.swing.plaf.basic.BasicRootPaneUI$DefaultAction.actionPerformed(BasicRootPaneUI.java:156)
>
>     at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1384)
>
>     at javax.swing.JComponent.processKeyBinding(JComponent.java:2078)
>
>     at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:252)
>
>     at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:205)
>
>     at
> javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2145)
>
>     at javax.swing.JComponent.processKeyBindings(JComponent.java:2138)
>
>     at javax.swing.JComponent.processKeyEvent(JComponent.java:2045)
>
>     at java.awt.Component.processEvent(Component.java:3553)
>
>     at java.awt.Container.processEvent(Container.java:1164)
>
>     at java.awt.Component.dispatchEventImpl(Component.java:2593)
>
>     at java.awt.Container.dispatchEventImpl(Container.java:1213)
>
>     at java.awt.Component.dispatchEvent(Component.java:2497)
>
>     at java.awt.LightweightDispatcher.processKeyEvent(Container.java:2155)
>
>     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2135)
>
>     at java.awt.Container.dispatchEventImpl(Container.java:1200)
>
>     at java.awt.Window.dispatchEventImpl(Window.java:914)
>
>     at java.awt.Component.dispatchEvent(Component.java:2497)
>
>     at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
>
>     at
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
>
>     at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
>
>     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
>
>     at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
>
> Question is :
> Why i got that exception from this line of code:
>   ResultSet rs_tmp = newItemPStat.executeQuery();
>
>
> Thanks.
>
>
>
>
>
>
> _________________________________________________________________
> Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Dave Cramer <Dave@micro-automation.net>