Hi, i am just a starter . and i just wanna know how can i use xml, JDBC, and servlets together.. i mean can i use JDBC and XML together in a very effective manner... but thenwhat willbe the flow.. i am confused.. can anyone guide me through!! harry
Harry, What is it you are trying to do? Do you want to use a servlet to retrieve a result set into an xml file? XML is not a kind of relational database, so there really is no JDBC driver for XML. However, XML does have something that works the similarly: SAX. SAX is an event based API for xml. The details of using the sax parser to extract data into an xml file are fairly lengthy but straightforward. If you're interested there is an article in JavaWorld which details exactly how to this. Hope this helps! [This message has been edited by Joe McGuire (edited June 13, 2001).]
Harjinder, The question is not can you use this or that technology together, but rather is this technology a good approach to solving my problem. What are you trying to accomplish? If we know that, we can suggest technology that is suited to your goal.
If ur question is to combine all these technologies together, then here's the answer in breif. First retrieve data from DBMS using JDBC and build a XML file using SAX or DOM API's. Then, use servlet to send this XML file to different server( XML is better chosen for EDI ie., in B2B scenario) and use parser at other side of server (use Servlet to get XML file over HTTP) to extract the XML file and update the database using JDBC. Or else if u wanna send XML file to browser use some style sheets (XSL or CSS) to be displayed in browser as all browsers can't understand XML file, only IE(Internet Explorer) has built-in parser. U can use these style sheets at server-side or at client-side. there is a good explanation abt these XML/XSL forum. HTH... Anil
SCJP 1.5, SCEA, ICED (287,484,486)
Joined: May 02, 2001
hi Gurus, Thanks!! i think i got what i wanted... Cheers HArry