java - How do I execute PreparedStatement(select object_id()) in sybase iq? -
we have small jdbc application talks sybase iq database does:
string objectname = "sys.syswebservice"; //the actual value of objectname not matter. //it view object in sys schema preparedstatement preparedstatement = connection.preparestatement("select object_id(?)"); preparedstatement.setstring(1, objectname); preparedstatement.executequery();
we getting error:
java.sql.sqlexception: jz0sa: prepared statement: input parameter not set, index: 0.s
jz0sa: prepared statement: input parameter not set, index: _____. action: sure each input parameter has value.
when change code
setstring(0, objectname)
i getting:
java.lang.arrayindexoutofboundsexception: -1 @ com.sybase.jdbc4.jdbc.sybpreparedstatement.a(unknown source) @ com.sybase.jdbc4.jdbc.sybpreparedstatement.a(unknown source) @ com.sybase.jdbc4.jdbc.sybpreparedstatement.a(unknown source) @ com.sybase.jdbc4.jdbc.sybpreparedstatement.setstring(unknown source)
we using jconn-4.0.jar:
manifest-version: 1.0 created-by: 1.6.0_03 (sun microsystems inc.) main-class: sybversion name: com/sybase/jdbcx/ implementation-vendor: "sybase, inc." specification-title: "jconnect jdbc 4.0" implementation-title: "com.sybase.jdbcx" implementation-version: "build (26502)" specification-version: "7.0" specification-vendor: "sybase, inc."
can tell me doing wrong? thank you.
despite api doc might say, think parameter index must zero-based, maybe bug in jdbc driver using. try zero-based index. setstring(0,....);
Comments
Post a Comment