如何在使用 createArrayOf() 方法时纠正“java.sql.SQLFeatureNotSupportedException”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15744437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 20:42:46  来源:igfitidea点击:

How to rectify the 'java.sql.SQLFeatureNotSupportedException' while using the createArrayOf() method

javamysqljdbc

提问by karthikbv

My code is as follows:

我的代码如下:

        PreparedStatement pstm = con.prepareStatement("insert into parameter(Parameter) values(?)");
        Array a = con.createArrayOf("TEXT",s1);
        pstm.setArray(1,a);
        pstm.executeUpdate();

The stacktrace is as follows:

堆栈跟踪如下:

   Exception in thread "main" java.sql.SQLFeatureNotSupportedException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at com.mysql.jdbc.SQLError.notImplemented(SQLError.java:1329)
at com.mysql.jdbc.JDBC4Connection.createArrayOf(JDBC4Connection.java:56)
at project.Project.main(Project.java:295)

Please help me in rectifying this issue. Thank you in advance.

请帮助我纠正这个问题。先感谢您。

回答by Thomas

http://docs.oracle.com/javase/6/docs/api/java/sql/SQLFeatureNotSupportedException.html

http://docs.oracle.com/javase/6/docs/api/java/sql/SQLFeatureNotSupportedException.html

It means that your mysql driver can't do that operation. Either use a different driver/database, or don't use that method.

这意味着您的mysql驱动程序无法执行该操作。要么使用不同的驱动程序/数据库,要么不使用该方法。