search

Home  >  Q&A  >  body text

mysql - Java中PreparedStatement的setArray如何正确使用

PreparedStatement pstmt = conn.prepareStatement("update message set see=1 where id in (?)");
Array array = conn.createArrayOf("VARCHAR", new Object[]{"1", "2","3"});
pstmt.setArray(1, array);
ResultSet rs = pstmt.executeQuery();

第二句报错 SQLFeatureNotSupportedException
尝试过将VARCHAR都小写还是一样的错

PHPzPHPz2893 days ago563

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 09:43:45

    It has nothing to do with your program. I guess the mysql you are using does not support setArray. Oracle and PostgreSQL support

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 09:43:45

    SQLFeatureNotSupportedException
    

    This exception has been made very clear, and the SQL feature is not supported. Check whether your database version supports it and whether the JDBC driver version corresponds to the database version

    reply
    0
  • Cancelreply