Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-09-2009
Member
 
Join Date: Apr 2009
Posts: 68
Unable to convert a JDBC Result Set into Xml File

Any ideas on how to convert a ResultSet to XML in Java? I have a problem to export my SQL query is resulty into an XML file. I need some java code to store my resultset in a xml file. And next the buyer or the user will select the books depends on the price ,so I have to store all the books in a xml and search according to the price.
Reply With Quote
  #2  
Old 23-09-2009
Member
 
Join Date: Apr 2008
Posts: 34
Re: Unable to convert a JDBC Result Set into Xml File

It looks like you are putting freely typed-in comments from end-users into an xml document. Simply convert your data into xml string. Write the string to the response stream, and set the content-type header as text/xml, and content-length header as length of string. The problem with this is that the user may enter characters in his text that have special meaning to xml and will have to be escaped correctly.
Reply With Quote
  #3  
Old 23-09-2009
Member
 
Join Date: Mar 2008
Posts: 232
Re: Unable to convert a JDBC Result Set into Xml File

XML has become the common format for passing data between components residing on different platforms. As far as searching goes I'm not quite sure what your actual requirements are here--how the data is stored shouldn't really matter to the searching, unless they're searching XML by just looking at the file. With the move to XML-based services, developers often find themselves converting various data structures to and from XML. Arguably, the most prevalent form of persisting data is in relational databases.
Reply With Quote
  #4  
Old 23-09-2009
Member
 
Join Date: Feb 2006
Posts: 126
Re: Unable to convert a JDBC Result Set into Xml File

The Hibernate Framework includes functionality for producing XML-based data derived from relational data. There is a simple toXML() method which handles this. The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Unable to convert a JDBC Result Set into Xml File"
Thread Thread Starter Forum Replies Last Post
The Search Result in Outlook 2007 does not show current years result Shika Windows Software 4 24-04-2012 07:53 AM
Unable to convert pdf file to epub for Mac. AjaxDEV Operating Systems 5 23-11-2011 01:42 AM
Unable to convert the .mkv file without subtitle Karunashankar Windows Software 6 31-03-2011 10:36 AM
Unable to convert any video file to avs file Hamlet Windows Software 5 08-03-2010 11:30 AM
Insert sql query result in a file TechGate Software Development 5 21-01-2010 11:52 AM


All times are GMT +5.5. The time now is 02:41 PM.