I want to change MULTISET column of the table, and my code looks something like this:
PreparedStatement pstm = preparedStatement("UPDATE table SET mc = MULTISET{?, ?} WHERE ...");
pstm.setString(1, "...");
pstm.setString(2, "...");
pstm.execute();
And I get error: "Illegal attempt to convert a collection type into another type.".
What is wrong with this? When I put real value开发者_开发百科s instead of '?' everything works just fine.
Btw... mc is defined like MULTISET(CHAR(20) NOT NULL)
Thank you...
I tested it using JDBC Informix drivers 3.50 and Jython 2.5.1 and it works. Maybe you use some old version of JDBC? I tested it both with execute()
and executeUpdate()
method. My code:
from java.sql import DriverManager
from java.lang import Class
Class.forName("com.informix.jdbc.IfxDriver")
db = DriverManager.getConnection(db_url, usr, passwd)
pstm = db.prepareStatement("UPDATE aaa_mc_test SET mc_test = MULTISET{?, ?}")
pstm.setString(1, "...")
pstm.setString(2, "...")
r = pstm.executeUpdate()
print('ok, updated: %d' % (r))
For 3 records I inserted to aaa_mc_test
table it prints out ok, updated: 3
精彩评论