0

I try to convert from string into xml using teiid server but when I run query this error always appear "java.io.OptionalDataException" ..I don't understand what the wrong.thank you

Iam trying to convert this simple string

'<row><id>1</id></row>'

into xml using CAST(expression AS xml) or CONVERT(expression, xml) and mysql query is SELECT ViewModel.table.column, CAST('1' AS xml) FROM ViewModel.table

Aser
  • 27
  • 4

1 Answers1

0

In Teiid if you want to convert string to an XML construct one needs to use `XMLPARSE' function. Please refer to all XML functions here [1]

[1] http://teiid.github.io/teiid-documents/master/content/reference/r_xml-functions.html

Ramesh Reddy
  • 554
  • 1
  • 3
  • 8
  • thanks for your reply... I did that also but same error appear ...any function which return xml type cause the same error – Aser Apr 08 '20 at 17:13
  • Then, in that case, you have library mismatch somewhere looks like, how are using the Teiid engine? in WildFly? – Ramesh Reddy Apr 08 '20 at 21:41
  • I use teiid engine with jboss EAP server , and use teiid designer at jboss developer studio – Aser Apr 11 '20 at 16:52
  • When i create datasource from xml file it works well and create xml table .... but when I use parsexml or any other function returns xml it cause this error ...any help plz? – Aser Apr 12 '20 at 07:47
  • Not sure what you mean by created Datasource, the parse function converts to XML type that can be used other XML functions or XMLTable. It needs to be well-formed – Ramesh Reddy Apr 12 '20 at 14:25
  • Yes I mean at teeid designer when I create new source by import xml file , it works fine and it create xml view using xml table , but when I try to use any xml function it fails at return this error – Aser Apr 13 '20 at 12:46
  • Can you post the whole exception? – Ramesh Reddy Apr 13 '20 at 16:32