public void InsertPWD(PwdItem encpwd) {
        if (this.connection == null || encpwd == null) {
            return;
        }

        try {
            int maxkey = 0;
            Statement stmt = null;
            stmt = this.connection.createStatement();

            //find the max id
            ResultSet rs = stmt.executeQuery("SELECT * FROM PASSWD;");
            while (rs.next()) {
                int id = rs.getInt("ID");
                if (id >= maxkey) {
                    maxkey = id + 1;
                }
            }
            rs.close();

            //add the element into the database
            String sql = "INSERT INTO PASSWD (ID,DOMAIN,USERNAME,PASSWORD,COMMENT) VALUES"
                    + "(" + maxkey + ","
                    + " '" + encpwd.getDomain() + "', "
                    + " '" + encpwd.getUsername() + "', "
                    + " '" + encpwd.getPassword() + "', "
                    + " '" + encpwd.getComment() + "') ";
            stmt.executeUpdate(sql);
            connection.commit();
            stmt.close();
        } catch (SQLException e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        }
    }