一部の jdbc コードを MySql から SQL Server に変換しています。しようとするとき
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();
}
}
}
問題のデータベース列は、null ではなく varbinary(max) として定義されています
コードは MySql を使用してうまく動作しますが、Sql Server で実行するにはどうすればよいかわかりません。
どんな提案でも大歓迎です