Riuppo il thread per un problema simile.
viene riportato questo errore:codice:public void aggiornaUsername() throws SQLException { String[] userPsw = new String[2]; userPsw = getUserPsw(); userPsw[1] = null; if (userPsw[0].equals(FormModificaUsername.campoUsername.getText())) { st.executeUpdate("UPDATE accesso SET username = '"+FormModificaUsername.campoNuovoUsername.getText()+"' WHERE id = " + 1); JOptionPane.showMessageDialog(null, "Username correttamente modificato", "Conferma modifica", JOptionPane.INFORMATION_MESSAGE); } else JOptionPane.showMessageDialog(null, "Errore", "Si è verificato un errore", JOptionPane.ERROR_MESSAGE); }
getUserPsw è un metodo che restituisce un array di due elementi, uno contenente uno username e l'altro la password.codice:java.sql.SQLException: Invalid handle at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7129) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338) at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288) at QueryDB.aggiornaUsername(QueryDB.java:339) at QueryDB.<init>(QueryDB.java:56) at FormModificaUsername.actionPerformed(FormModificaUsername.java:97) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Errore di tipo SQLException
L'errore che ricevo si verifica quando si va ad eseguire la query.
Tutti i parametri di connessione sono settati, anche perchè tanti altri metodi funzionano a perfezione.
Cosa potrebbe essere?
tnx!

Rispondi quotando