title: Passing an String array to a Prepared Statement Array (JDBC + SQLServer)
body: <p>I'm trying to pass an String array to a prepared statement, but it's returning this exception: </p>
  
  <pre><code>java.sql.SQLFeatureNotSupportedException: This operation is not supported.
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.createArrayOf(SQLServerConnection.java:2763)
      at entity.dao.getRecords(Dao.java:168)
      at entity.dao.main(Dao.java:227)
  </code></pre>
  
  <p>my code is:</p>
  
  <pre><code>public List&lt;Record&gt; getRecords() throws SQLException {
          String sql = "select * from table where clause in (?)";
  
          PreparedStatement ps = this.connection.prepareStatement(sql);
  
          List&lt;String&gt; strings = new ArrayList&lt;&gt;();
          strings.add("string1");
          strings.add("string2");
          strings.add("string3");
  
          Array array = this.connection.createArrayOf("VARCHAR", strings.toArray());
  
          ps.setArray(1, array);
  
          ResultSet executeQuery = ps.executeQuery();
          List&lt;Record&gt; records = new ArrayList&lt;Record&gt;();
          Record record;
          while (executeQuery.next()) {
              // ...
          }
          return records;
      }
  </code></pre>
  
  <p>the line of the exception is <code>Array array = this.connection.createArrayOf("VARCHAR", strings.toArray());</code></p>
  
  <p>it's when i try to create the Array.</p>
  
  <p>I already searched how to pass the Array and everybody tells to do like this, but seems to don't work with SQLServer.</p>