File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes inserting xml string into oracle database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "inserting xml string into oracle database" Watch "inserting xml string into oracle database" New topic

inserting xml string into oracle database

SP Nam
Ranch Hand

Joined: Oct 15, 2003
Posts: 41
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
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
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....

Take a Minute, Donate an Hour, Change a Life
Praveen kumara

Joined: Oct 06, 2004
Posts: 1
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
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245

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.

Hemanth Pallavajula
Ranch Hand

Joined: Oct 07, 2004
Posts: 38
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'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.

Cheers,<br />Hemanth...<br />(When opportunity doesn't knock, build a door.)
I agree. Here's the link:
subject: inserting xml string into oracle database
It's not a secret anymore!