• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

oracle and java objects

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
any idea on how to store java objects to oracle database and retrieve it???
my req: is that, i have to store java exceptions generated into database and then retrive it to genearte various reports for future analysis.
we are using servlets and oracle 9i in Linux

thanks in advance
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"sreejayan"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks! and welcome to the JavaRanch!
Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While I know it is possible to save an object somehow in Oracle. there are also three other solutions you could use.
1. use the methods of Exception to create a string that you save in a field.
2. Using Serialization, serialize the object and save the text in a field. When you reread the field, unmarshal it into the object.
3. Using Jaxb, data binding, you can always save the object as XML and store the XML in the table. Or even have the table structure match the XML so that you can load and unload the data between XML and database quickly and easily.
Now of course realize that I don't have actual experience doing the above ways, but they are ways that I thought of as possible ways.
Mark
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
loadjava command is used to store the java classes to oracle database schema
you can see all the options using
loadjava -help
There is little difference based on the driver you are using thin or oci
for thin driver it is
loadjava -user username/password@host ort:SID -thin nameofclass.class
where -user option will load in the schema of user "username".
I hope it helps.
[ August 08, 2002: Message edited by: swati gupta ]
I don't know why the face with tongue out is displaying there I want to write host port sid with : in between.
[ August 08, 2002: Message edited by: swati gupta ]
 
Swati Gupta
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also you can query that your class is loaded in database schema with valid status or not using
select object_name,status
from user_objects
where Object_type ='JAVA CLASS';
For objects to be valid you should use the
-resolve option of loadjava.
You will have to publish the call specs for methods you want to use.
 
reply
    Bookmark Topic Watch Topic
  • New Topic