code: @Override
      public long nextSequence(final ConnectionResource _con,
                               final String _name)
          throws SQLException
      {
          final long ret;
          final Statement stmt = _con.createStatement();
          try {
              // insert new line
              final String insertCmd = new StringBuilder()
                      .append("INSERT INTO `").append(MySQLDatabase.PREFIX_SEQUENCE).append(_name.toLowerCase())
                      .append("` VALUES ()")
                      .toString();
              final int row = stmt.executeUpdate(insertCmd, Statement.RETURN_GENERATED_KEYS);
              if (row != 1)  {
                  throw new SQLException("no sequence found for '" + _name + "'");
              }
  
              // fetch new number
              final ResultSet resultset = stmt.getGeneratedKeys();
              if (resultset.next()) {
                  ret = resultset.getLong(1);
              } else  {
                  throw new SQLException("no sequence found for '" + _name + "'");
              }
          } finally {
              stmt.close();
          }
          return ret;
      }
docs: Fetches next number for sequence <code>_name</code> by inserting new
  row into representing table. The new auto generated key is returned as
  next number of the sequence.
  
  @param _con      SQL connection
  @param _name     name of the sequence
  @return current inserted value of the table
  @throws SQLException if next number from the sequence could not be
  fetched
  @see #PREFIX_SEQUENCE