aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "inserting xml string into oracle database" Watch "inserting xml string into oracle database" New topic
Author

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....
Thanks.


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Praveen kumara
Greenhorn

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

Regards
Praveen Kumar.A

pra_master@yahoo.co.in
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Praveen,

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.

Thanks!
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 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.


Cheers,<br />Hemanth...<br />(When opportunity doesn't knock, build a door.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inserting xml string into oracle database
 
Similar Threads
Coverting DB to XML and vice-versa
Extract db data into a XML
MetaData framework
inserting xml strings
How a Distributed application differs from client server application,