• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

inserting xml string into oracle database

Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am developing a messaging application in xml is extensively used to transfer data between database, middle tier and client tier.

From client side I get xml string without any table names (its like xml document). I have to extract values w.r.t column names as tags from xml string and insert into Oracle database. Can anyone send a snippet of code or links to achieve this functionality, its bit urgent.

Praveen kumar
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Urgency huh! Great.

So what's your design philosophy ?

Do you plan to parse the XML document ?
If its just a string then is it something that has delimiters ?
(Comma seperated string, tab delimited string?)

If its XML, do you use Java parsers, C++ parsers ?
If you could provide a bit more info, maybe someone can suggest
a workable solution....from the way you posted, its a very open
ended question and the possibilities are unlimited.

If you could provide some additional info....
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI madhav,

Hi all

I am developing a application.
The architecture is as follows
Client(Front End) : C# .NET
Middle Tier : J2EE
Backend : Oracle 9i

From client side I will get string which contains data in standard XML format.
The String contains contains tablenames,column names and their corresponding values.
I need to parse the XML String and extract the contents(columnn names and their values) and insert the values into the corresponding tables in the Oracle database.

Yes I have planned to parse the xml String using java parser.

NO,It's not a normal string,It's a normalised XML document in the form of a string.

Please send me how to go about it and if possible pls send the code snippet.
It will be very helpful for me.
It's bit Urgent.

Hoping for a faster response

Thanking u in advance

Praveen Kumar.A

Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am wokring on similar problem as yours.
However we do not have Java environment. I am using plsql procedure and use DBMS_XMLSAVE procedure as we have Oracle 9.2

Let me know if it something you are intrested in or are you looking for Java solutions only.

Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praveen,

I have the solution for you. The solution is you need to use Castor, Xerces jars. What actually needs to be done is that, you need to create an object map for the xml String. We can also say that, you need to create Castor Objects for the XML. Then you need to unmarshal the xml. When you unmarshal an xml, you will get the require data from it in the form of an attribute's value of a bean. So, you will be having table name, column name and also data to insert from the XML in your hands from these attributes' values. So, only insertion of data into database remains.

You please visit Exolab.org's Castor Home Page. There you will find the code for unmarshalling and marshalling, creation of Castor objects and lot more.

Anyway, I am here to help you in this regard.
If I'd had more time, I would have written a shorter letter. -T.S. Eliot such a short, tiny ad:
professionally read, modify and write PDF files from Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!