SAP Knowledge Base Article - Preview

2159562 - jConnect: Insert into select SQL fails when ENABLE_BULK_LOAD=BCP and DYNAMIC_PREPARE=false, ArrayIndexOutOfBoundsException or ClassCastException - SAP SDK


  • Running command like Insert into #temptest select [column list] from table where c1 >= ? AND (c2 = 'one' OR c2 = 'two) AND (c4 >= ? OR c4 >= ?) fails with the following:
    • java.lang.ArrayIndexOutOfBoundsException: while trying to store to index -1 of an object array with length 4, loaded from field com.sybase.jdbc4.jdbc.SybPreparedStatement._object of an object loaded from local variable 'this'
      at com.sybase.jdbc4.jdbc.SybPreparedStatement.setParamBulk(
      at com.sybase.jdbc4.jdbc.SybPreparedStatement.setParam(
      at com.sybase.jdbc4.jdbc.SybPreparedStatement.setParam(
      at com.sybase.jdbc4.jdbc.SybPreparedStatement.setTimestamp(
      at TestPrepareDatetime.main(
  • If the literals are removed from the where clause and parameters are Timestamp (where c4 >= ? AND (c4 >= ? OR c4 >= ?)):
    • java.lang.ClassCastException: Cannot cast class com.sybase.jdbc4.tds.SybTimestamp to class com.sybase.jdbc4.jdbc.DateObject
      at com.sybase.jdbc4.tds.TdsParam.checkDateRange(
      at com.sybase.jdbc4.tds.TdsParam.prepareForSend(
      at com.sybase.jdbc4.jdbc.ParamManager.checkParams(
      at com.sybase.jdbc4.tds.Tds.language(
      at com.sybase.jdbc4.jdbc.SybStatement.sendQuery(
      at com.sybase.jdbc4.jdbc.SybPreparedStatement.sendQuery(
      at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(
      at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeUpdate(
      at TestPrepareDatetime.main(



  • jConnect
    • JDBC 7.07
    • JDBC 16
  • SAP Adaptive Server Enterprise (ASE) 15.7 and 16.0
  • SAP Sybase Software Developers Kit (SDK) 15.7
  • SAP Software Developers Kit (SDK) for Adaptive Server Enterprise (ASE) 16.0
  • SAP Java Virtual Machine 1.7


SAP Adaptive Server Enterprise 15.7 ; SAP Adaptive Server Enterprise 16.0 ; SAP Adaptive Server Enterprise SDK 16.0 ; Sybase SDK 15.7 ; Sybase Software Developer Kit 15.7


jconn, OCS, SDK for SAP ASE, CR#783068, CR783068, 783068 , KBA , jconn , BC-SYB-SDK , SDK , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.