正在尝试更新mysql驱动程序以摆脱java.sql.SQLFeatureNotSupportedException

正在尝试更新mysql驱动程序以摆脱java.sql.SQLFeatureNotSupportedException,java,mysql,jdbc,Java,Mysql,Jdbc,我使用的声明如下: List<Integer> ids = new ArrayList<Integer>(); ids.add(SelectQueueRS.getInt("DTSId_int")); PreparedStatement updateOriginal = connMain.prepareStatement( "UPDATE test.selectiontable SET DTSStatusType_ti = 3, Queued_DialerIP_vch

我使用的声明如下:

List<Integer> ids = new ArrayList<Integer>();

ids.add(SelectQueueRS.getInt("DTSId_int"));

PreparedStatement updateOriginal = connMain.prepareStatement(
"UPDATE test.selectiontable SET DTSStatusType_ti = 3, Queued_DialerIP_vch = ?" +
"WHERE DTSId_int IN (?)");


updateOriginal.setString(1, CurrRemoteIPAddress);
updateOriginal.setArray(2,connMain.createArrayOf("string", ids.toArray()));
updateOriginal.executeUpdate();
这是我的堆栈跟踪:

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)
我浏览了一些旧的Stackoverfollow帖子,讨论了许多人在这里讨论的相同问题 建议不要使用
createArrayOf
方法

1) 我想知道,我是否可以更新我的JDBC驱动程序,这样我就不必更改代码中的任何方法了 在此之前,我必须签入NEtbeans,我目前正在使用的版本。知道怎么查吗

2) 如果不是上述步骤,请告知我可以做哪些更改

谢谢


我提到的一些帖子:

来自statcktrace:

Exception in thread "main" java.sql.SQLFeatureNotSupportedException
很明显,您使用的
驱动程序不支持该功能

  • 我当前使用的版本
使用正在使用的
驱动程序的实例
,可以找到其
版本

int major = driver.getMajorVersion();
int minor = driver.getMinorVersion();
但是,顺便说一句,由于MySQL不支持自定义数据类型,例如
array
,因此更改驱动程序将不起作用

  • 如果不是上述步骤,请告知我可以做哪些更改
或者,您可以在值列表中准备循环查询,设置占位符,然后在执行前设置值

示例

StringBuilder sqlSelect = new StringBuilder( 1024 );
sqlSelect.append( "UPDATE test.selectiontable " )
         .append( "SET DTSStatusType_ti = 3, ")
         .append( "Queued_DialerIP_vch = ? " )
         .append( "WHERE DTSId_int IN ( " ); 

int paramCount = ids.size();
if( paramCount > 0 ) {
  for( i = 0; i < paramCount; i++ ) {
    sqlSelect.append( ( i > 0 ? ", ?" : "?" );
  } // for each param
  sqlSelect.append( " )" );
} // if ids list is not empty

// make the prepare statement (pst) with the above sql string
PreparedStatement pst = 
    connMain.prepareStatement( sqlStatement.toString() );

// now set the parameter values in the query
int paramIndex = 1;

pst.setString(paramIndex++, CurrRemoteIPAddress);

if( paramCount > 0 ) {
  for( i = 0; i < paramCount; i++ ) {
    pst.setLong( paramIndex++, 
                 ( (Integer)ids.get( i ) ).intValue() );
  } // for each param
} // if ids list is not empty

pst.executeUpdate();
StringBuilder sqlSelect=新的StringBuilder(1024);
sqlSelect.append(“更新test.selectiontable”)
.append(“设置DTSStatusType_ti=3,”)
.append(“排队的拨号器IP\U vch=?”)
.append(“WHERE DTSId_int IN(”);
int paramCount=ids.size();
如果(参数计数>0){
对于(i=0;i0?,?“:”);
}//对于每个参数
sqlSelect.append(“)”;
}//如果ids列表不为空
//使用上述sql字符串生成prepare语句(pst)
已编制报表pst=
prepareStatement(sqlStatement.toString());
//现在在查询中设置参数值
int参数索引=1;
pst.setString(paramIndex++,currentRemoteIPAddress);
如果(参数计数>0){
对于(i=0;i
StringBuilder sqlSelect = new StringBuilder( 1024 );
sqlSelect.append( "UPDATE test.selectiontable " )
         .append( "SET DTSStatusType_ti = 3, ")
         .append( "Queued_DialerIP_vch = ? " )
         .append( "WHERE DTSId_int IN ( " ); 

int paramCount = ids.size();
if( paramCount > 0 ) {
  for( i = 0; i < paramCount; i++ ) {
    sqlSelect.append( ( i > 0 ? ", ?" : "?" );
  } // for each param
  sqlSelect.append( " )" );
} // if ids list is not empty

// make the prepare statement (pst) with the above sql string
PreparedStatement pst = 
    connMain.prepareStatement( sqlStatement.toString() );

// now set the parameter values in the query
int paramIndex = 1;

pst.setString(paramIndex++, CurrRemoteIPAddress);

if( paramCount > 0 ) {
  for( i = 0; i < paramCount; i++ ) {
    pst.setLong( paramIndex++, 
                 ( (Integer)ids.get( i ) ).intValue() );
  } // for each param
} // if ids list is not empty

pst.executeUpdate();