I need help regarding XML file storage in Database. Which Database can be used to save the complete XML file as a string? and in my Java code I need to retrieve this String and parse it using JAXB. Can someone please help me out.. Which database do i need to use?
Are you looking for any realtime project or just for learning purpose?
There are many databases that support this feature; well I can tell you what i have worked on
Use Oracle 9.2 onwards (i think even 8 should also support but i never worked on that)
declare that XML column you want to store as String as CLOB
use Oracle driver (say ojdbc.jar) and use normal JDBC api
let me know incase you need any specific information
“The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'.”
Thanks a lot for the Help
Abhijit - I am looking for a realtime project. I want to use an open source. Currently I am working on Derby embedded driver.
Ganesh - I want to store around 25 XML files, and these file will be called as and when required. These XML files should be saved as it is. I am using JAXB to parse them. So basically my requirement is,
1. XML to be saved in the database,
2. Retrieve the XML as an XML file itself.
So how can I proceed? Once again thanks for the help
Yes I am using Unmarshall command. So as per your post, I should try saving the XML file in a column, with the column data type as varchar?
Then in that case Derby can support the same?
Hi p Gpune,
I don't want to put the XML content, rather I want to save the XML file as a String in the db, and retrieve the same string as a ".xml" file in my Java code and then parse it. Is there an easier way to do so in derby?
Now I have another problem thou,
I need to create an array of hashmap..
for example i want fetch data from the XML that I placed in the database and store it in a result set object, this contains around 25 to 30 number of rows. I want copy those resultset data to the Hashmap. and this Hashmap should be referred first when i need to check some data, in case the data doesnt exist in the Hashmap then the control should be passed to the database an then the again the data would be parsed. This data again has to be saved in the Hashmap.
So basically my Hashmap would be used as an interface. Is this possible? one more doubt, will the data that is stored in hashmap be accessible or would it be deleted every time I run my code?
My code is such that, I am generating 3D objects in a JFrame, these objects data is in XML files. These XML files are placed inside the DB. Now what I want to do is, instead of referring to the DB every time I want to create an object, I just want to place the parsed data inside a Hashmap, so that it acts like a memory storage and also it would not affect the performance of the code.
I would definitely try your code. Thanks once again