title: How to extract Object[] and get it into query using preparedstatement setObject()?
body: <p>might be a silly question but I cant get the query running. This is my code:</p>
  
  <pre><code>ArrayList&lt;Attraction&gt; getAttraction(Object[] obj) throws SQLException
  {
  
      Connection connection = facade.getConnection();
  
      ArrayList&lt;Attraction&gt; attractions = new ArrayList&lt;&gt;();
  
      // Check obj value
      System.out.println(java.util.Arrays.toString(obj));
  
      PreparedStatement ps = connection.prepareStatement("SELECT DISTINCT attra.attractid,attractname,x,y,z,age,weight,"
              + "height,duration,price,status FROM attraction attra "
              + "INNER JOIN attrib_bridge ab ON attra.attractId = ab.attractId "
              + "INNER JOIN attribute attri ON ab.attributeId = attri.attributeid"
              + "WHERE attri.attributename IN ?");
  
      ps.setString(1, java.util.Arrays.toString(obj));
  
      ResultSet rs = ps.executeQuery(); 
  
      while(rs.next()){
  
          // Initialize attraction object
          Attraction attraction = new Attraction();
  
          attraction.setAttractionId(rs.getInt(1));
          attraction.setAttractionName(rs.getString(2));
          attraction.setxLocation(rs.getInt(3));
          attraction.setyLocation(rs.getInt(4));
          attraction.setzLocation(rs.getInt(5));
          attraction.setMinAge(rs.getInt(6));
          attraction.setMaxWeight(rs.getInt(7));
          attraction.setMinHeight(rs.getInt(8)); 
          attraction.setRideDuration(rs.getInt(9));
          attraction.setPriceRide(rs.getInt(10));
          attraction.setStatus(rs.getString(11));
  
          // Add new object to to movies
          attractions.add(attraction);
      }
  
      return attractions;
  }
  </code></pre>
  
  <p>And this is the error I get :</p>
  
  <blockquote>
    <p>[Gentle rides, Thrill rides, Transport rides]
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in >your SQL syntax; check the manual that corresponds to your MySQL server version >for the right syntax to use near 'attri.attributename IN '[Gentle rides, Thrill >rides, Transport rides]'' at line 1</p>
    
    <p>at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2293)
        at com.ThemeParkG02.rs.control.manager.ManageAttraction.getAttraction(ManageAttraction.java:123)
        at com.ThemeParkG02.rs.control.manager.Facade.getAttraction(Facade.java:85)
        at com.ThemeParkG02.rs.control.listener.ViewAttractionListListener.run(ViewAttractionListListener.java:32)</p>
  </blockquote>
  
  <hr>
  
  <p>I'm really dizzy right now. The values is out but I the query is not working. The '[' and ']' really blocking my goal. Any input guys? </p>
  
  <p>Thanks in advance.</p>