0
我正在將一些jdbc代碼從MySql轉換爲SQL Server。嘗試異常:從UNKNOWN到UNKNOWN的轉換不受支持
query = "Update ReportSetup "
+ "set N_ID=?, "
+ "R_Default=?, "
+ "R_Name=?, "
+ "R_Module=? "
+ " where R_ID = ?";
}
PreparedStatement stmt =
(PreparedStatement) con.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);
stmt.setInt(1, ri.getNodeID());
stmt.setInt(2, (ri.isDefault()) ? 1 : 0);
stmt.setString(3, ri.getName());
Object o = ri.getReportModule();
stmt.setObject(4, o);
最後一條語句stmt.setObject(4,o)
引發異常。
ri.getReportModule returns an instance of a class which implements Externalizable.
該類的方法的writeExternal()被實現爲
public final void writeExternal(final ObjectOutput objectOutput) throws IOException {
for (int i=0; i<pdV.size(); i++) {
PropertyDescriptor pd = pdV.elementAt(i);
try {
Method m = pd.getReadMethod();
Object val = pd.getReadMethod().invoke(this);
System.out.print("writing property " + i + ": " + pd.getName() + " = " + val);
objectOutput.writeObject(val);
} catch (Exception e) {
e.printStackTrace();
}
}
}
所討論的數據庫列定義爲 VARBINARY(最大),而不是空
代碼工作以及使用MySql,但我無法弄清楚如何使它與Sql Server一起運行。
任何建議將非常讚賞