title: org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
body: <p>I have the following code:</p>
  
  <pre><code>String insert = "INSERT INTO " + tableName +
                  "(" + COLUMNS.TILE_ID + "," + COLUMNS.TILE_DATA + "," +
                  COLUMNS.TILE_LEVEL + "," + COLUMNS.TILE_COLUMN +
                  "," + COLUMNS.TILE_ROW +
                  "," + COLUMNS.TILE_IMAGE_FORMAT + "," + COLUMNS.TILE_SOURCE +
                  ")";
  String values = id + ",?" + "," +
                  tile.getLevel() + "," + tile.computeColumn() + "," +
                  tile.computeRow() + ",\'" + tile.getFileType().toUpperCase() +
                  "\'," + "\'" +
                  tile.getSource() + "\');";
          String query = insert + " VALUES (" + values;
          System.out.println(query);
          PreparedStatement statement = conn.prepareStatement(query);
          statement.setBytes(2, tile.getData());
          return this.conn.createStatement().executeUpdate(query);
  </code></pre>
  
  <p>The query value:</p>
  
  <blockquote>
    <p>INSERT INTO level1 (TILE_ID,TILE_DATA,TILE_LEVEL,TILE_COLUMN,TILE_ROW,TILE_IMAGE_FORMAT,TILE_SOURCE) VALUES (0,?,1,0,0,'JPG','null');</p>
  </blockquote>
  
  <p>The <strong>error</strong> I get:</p>
  
  <blockquote>
    <p>org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1.</p>
  </blockquote>
  
  <p>My Table:</p>
  
  <pre><code>tile_id bigint NOT NULL,
    tile_data bytea,
    tile_level smallint,
    tile_row integer,
    tile_column integer,
    tile_image_format image_format,
    tile_source character varying(30),
    CONSTRAINT level10_pkey PRIMARY KEY (tile_id)
  </code></pre>
  
  <p>Any ideas?</p>