Working on a project where I have to add new data to different tables (i'm new at this). I'm using Netbeans which is connected to a mysql database. The database is working fine and my queries work when I execute them directly. But when I try to update the tables with new data through my javacode, it fails. 

**Code:**

```
ConnectionClass db = new ConnectionClass();
    try {
        db.ConnectToDb();
    } catch (SQLException ex) {
        Logger.getLogger(AddUser.class.getName()).log(Level.SEVERE, null, ex);
    }

      String sql = "insert into users values (3, 'Nicklas', 'niklas@alskart.se', 'nisun', 'heej', '1')";

       /* String laggTill = "insert into agent values ("+idb.getAutoIncrement("agent", "aid")+
            ", '"+tfNamn.getText()+"', '"+tfNr.getText()+"', '"+tfMail.getText()+"')";

      */

    try {
        db.myStmt.executeUpdate(sql);
    } catch (SQLException ex) {
        Logger.getLogger(AddUser.class.getName()).log(Level.SEVERE, null, ex);
    }

}        

```

**Exception Generated:** 

```
apr 10, 2015 1:17:47 EM Project.AddUser btn_saveNewUserActionPerformed
ALLVARLIG: null
    java.sql.SQLException: No operations allowed after statement closed.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:937)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:872)
    at com.mysql.jdbc.StatementImpl.checkClosed(StatementImpl.java:445)
    at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1554)
    at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1549)
    at Project.AddUser.btn_saveNewUserActionPerformed(AddUser.java:159)

```