Hi,
I have created XML file which I am passing to SQL database as string.
Everything look ok unitl my string comming to the SQL database procedure as string where I am having error below.
Is anyone having an idea what can be. Also you can see an image of my work.
Thanks
Z
Exception in component tMSSqlSP_2
java.sql.SQLException: XML parsing: line 1, character 44, unable to switch the encoding
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:561)
I have been banging my head against the wall with the same issue loading raw XML into a MS SQL Server 2014 XML datatype column.
Changing the encoding of or removing the XML declaration line from the input file did not work.
Adding the following value to the jtds connection string ("Additional Parameters" option) worked. The setting of source file encoding and the xml declaration are irrelevant.
"sendStringParametersAsUnicode=false"
jtds options:
https://www.qint.de/joria/doc/jdbc/jtds.html Screenshot of Talend MS SQL Server jdbc Connection properties
FYI - I've also found using the AdditionalParams option of "sendStringParametersAsUnicode=false" useful when updating table data withe US default collation level of "SQL_Latin1_General_CP1_CI_AS".
Without this, it often ignores any indexes and performs a full table scan.