• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Coverting DB to XML and vice-versa

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I convert my DB(of any DBMS) into XML knowing that multiple interrelated tables are there in my database?
Can I modify XML at run time to insert the data into DB?
I would be very much thankful to get a solution.
Regards
Pankaj
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DB result set to XML -
You can write a little framework on top of JDBC layer that converts the resultset into an XML document. All column names will become element tags with column values as element content. Since JDBC allows you to retrieve column names from the result set, this shouldn't be too difficult.
XML to DB insert/update/delete
Once you've figured out how want to represent the result set as XML document, this step should be easy, since it is the exact reverse of the previous step. Using a parser, you will extract the element names( which maps to column names ) and elemement content ( which maps to column value ) and build the actual SQL statement.
Remember, XML by itself doesnot have the intelligence to "ask" the database to interpret its content for generating queries. Since XML is pure data, it becomes your onus to provide the middle-tier that looks at the data and take an appropriate action.
Having said that, I encourage you to take a look at various database vendors who are coming up with built-in XML support( the new acronym is XQL !!). Oracle for instance, in their latest version 8i has added extensive XML support. You can create table that has XML columns in it, build relational queries across normal columns and XML columns, retrieve the resultset in an XML format and submit queries as XML documents.
Checkout the XML Home at Oracle Technet website for very interesting articles and free downloads.
We're getting there....
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
pankaj bansal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx Ajith
I got the point. I'll try this.Thanx again.
Regards
pankaj
------------------
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic