I have a Query, which I execute in SQL server 2005/2008, gives me output in XML format.
Here is the sample query to generate xml output :
SELECT
(SELECT 'White' AS Color1,
'Blue' AS Color2,
'Black' AS Color3,
'Light' AS 'Color4/@Special',
'Green' AS Color4,
'Red' AS Color5
FOR XML PATH('Colors'),TYPE),
(SELECT 'Apple' AS Fruits1,
'Pineapple' AS Fruits2,
'Grapes' AS Fruits3,
'Melon' AS Fruits4
FOR XML PATH('Fruits'),TYPE)
FOR XML PATH(''),ROOT('SampleXML')
What I need is, to read the output in Java to convert it to a java.io.File format, so I can parse and populate objects.
I tried : SQLXML sqlxml = resultSet.getSQLXML(column);, which is given in here
But it is throwing an exception : Exception in thread "main" java.lang.AbstractMethodError: com.inet.pool.g.getSQLXML(I)Ljava/sql/SQLXML;
Please suggest me a way to read the file.
Plz Note : I am able to read the o/p as String using resultSet.getString(column), but not able to parse it.