There is application for read xml file (as byte) and writing (setBytes) it into table.column which is xml type. MS SQL SERVER 2005.
If I use jtds 1.2.5 then get error Operand type clash: image is incompatible with xml
try { FileInputStream is = new FileInputStream(f); is.read(b); is.close(); try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://SERVER;instance=INSTANCE", "user", "pass"); PreparedStatement pstmt = conn.prepareStatement("INSERT INTO TEST_XML (DATA_XML) VALUES (?)"); pstmt.setBytes(1, b); pstmt.execute(); pstmt.close(); conn.close(); } catch (Exception sqle) { System.out.println("ERROR " + sqle.getMessage()); System.exit(1); } } catch (FileNotFoundException e) { System.out.println(e); } catch (IOException e) { System.out.println(e); }
Microsoft jdbc driver is able to write byte into xml column
Is there possibility for add this feature into jTDS?
Best regards,
Skotinin
Hi Skotinin,
please add a corresponding feature request via sourceforge tracker (include a link to this thread so the sample code will not get lost).
Cheers,
momo
Log in to post a comment.
There is application for read xml file (as byte) and writing (setBytes) it
into table.column which is xml type. MS SQL SERVER 2005.
If I use jtds 1.2.5 then get error Operand type clash: image is incompatible
with xml
Microsoft jdbc driver is able to write byte into xml column
Is there possibility for add this feature into jTDS?
Best regards,
Skotinin
Hi Skotinin,
please add a corresponding feature request via sourceforge tracker (include a
link to this thread so the sample code will not get lost).
Cheers,
momo