Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

XML encoding

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)
Labels (5)
3 Replies
Anonymous
Not applicable
Author

Hi,
From Microsoft - http://support.microsoft.com/kb/232580. For other related posts do search on 'SQL server encoding'.
HTH
Anonymous
Not applicable
Author

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
0683p000009MD9b.png
David_Beaty
Specialist
Specialist

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.