How to store java objects in the database

Hi,
I am trying to store HttpSession state across Application Servers. Basically I am trying to build a sort of application cluster server on my own. I thought the best way to do this was to periodically store the HttpSession object from an application server in a database.
I created a table in Oracle 8i with a blob column. I use a PreparedStatement.setObject() method to store the HttpSession object in the database. My problem is, I don't know how to get the object back from the database.
Since ResultSet.getBlob returns the Blob locator, I need to read the BinaryInputStream to get all my data back. This tells me that getBlob basically works only for things like files, and cannot be used for Java objects.
Is there any way around this? Your input would be much appreciated.
Regards,
Somaiah.

Thanks for the quick reply vramakanth.
Do I have to use a type map if I do this? Also does such a type map exist for the HttpSession class?
Thanks,
Somaiah.

Similar Messages

  • Ho to store java objects in oracle database

    HI
    for me the sceanario is,
    i neeed to create , dynamically a table at the time of specified action.
    i need to store the values retreieved from session and store it in a database..
    for example
    User usr=session.getAttribute("usr"); i need to store the user object.
    and hashtable and hashmap values without iterating.
    please suggest at the earliest
    can it be done?
    Regards,
    Ramesh

    my requirement is like that,bcos of two different weblogic servers need to acess the central database.which contains user information.
    The user object from first server will be stored in database.and the second server will retrieve the user information and it will set for its application.
    please suggest me how to store java objects in database.
    regards,
    Ramesh

  • How to return java objects on the button click

    hello all,
    i wonder if any body let me know ,how to return java objects on button click,
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class base
         base()
              JFrame frame = new JFrame("Base class Message Dialog Box");
              JPanel panel = new JPanel();
              JButton buttonchildone = new JButton("Child class one");
              buttonchildone.addActionListener(new ActionListener(){
                   public actionPerformed(ActionEvent e)
                        childone ch1=new childone();
                   return ch1;
              JButton buttonchildtwo = new JButton("Child class two");
              buttonchildtwo.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e)
                        childtwo ch2=new childtwo();
                        return ch2;
              panel.add(buttonchildone);
              panel.add(buttonchildtwo);
              frame.add(panel);
              frame.setSize(300, 300);
              frame.setVisible(true);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         void show()
              System.out.println("Base class show() method");
    public class mainmethod
         public static void main(String[] args)
              base baseobj=new base();
    here my aim is to achieve dynamic polymorphism by button click's ,where based on the button click i can send back an object of childone or childtwo classes
    thanks and regard
    Mac
    Message was edited by:
    LoveOpensource

    You probably need to rethink your design. Where are these child classes going? What is using or consuming them? I agree with the message above about a button instantiating a parent field variable to one child or the other depending on which button is pressed.
    Message was edited by:
    petes1234

  • How to store java object in oracle

    Hi all,
    is it possible to store jva object in oracle.
    I have defined myClass. It have only data fields ( no methods).
    I make myClass myObject = new myClass();
    How can I store this object in oracle DB.
    Many thanks in advance.

    1.Convert this object into stream of Bytes.
    2.create a new InputStream from these Byte array.
    2.Use the setBinaryStream to set the values inside the table's column.
    3.Store this object as a Blob in the table (column type must be Blob).
    Hope this helps.
    Sudha
    PS:- Somebody explained in this forum how to convert an Object into Byte array .

  • How to find out  Locks on the database objects

    how to find out Locks on the database objects

    The following notes should be helpful:
    Note: 200590.1 - bde_session_locks.sql - Locks for given Session ID
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=200590.1
    Note: 1039273.6 - SCRIPT: VIEWING LOCKS ON OBJECTS HELD BY SPECIFIC USER
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=1039273.6
    You can also search Metalink, there are many notes/scripts published there which would be also helpful.

  • How to check the owner of any Object in the database.

    How to check the owner of any Object in the database.
    Thanks
    Himanshu

    What about this ?
    SELECT owner,Object_name,object_type FROM all_objects
    OR
    SELECT owner,Object_name,object_type FROM dba_objects

  • How to add a ChartOfAccounts object into the database.

    how to add a ChartOfAccounts object into the database. please shows sample code
    thanks

    Dim CoA As SAPbobsCOM.ChartOfAccounts
                CoA = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oChartOfAccounts)
                CoA.Code = 11223344
                CoA.ExternalCode = "a1234"
                CoA.ForeignName = "f Test Account"
                CoA.Name = "Test Account"
                CoA.AccountType = SAPbobsCOM.BoAccountTypes.at_Other
                CoA.ActiveAccount = SAPbobsCOM.BoYesNoEnum.tYES
                CoA.FatherAccountKey = 100001
                If CoA.Add <> 0 Then
                    MessageBox.Show(oCompany.GetLastErrorDescription)
                Else
                    MessageBox.Show("Added Account")
                End If
    Remember the father account key must be a valid account number in the company where you are trying to add the new account.  (The G/L Account code seen in the SBO client)

  • Newbie question on how to return java objects from java stored procedures

    Hi,
    As you may guess, i'm new to this.
    I have a stored procedure that does some calculations and creates a list of java objects as the result of the query.
    How would I return the list from the database to the client application?
    Would I have to create an Oracle type that maps to the java object?
    Please help.
    Jag

    Hi Jag,
    Your question is very vague (to me). Perhaps you could post what you have done so far? Have you tried looking through the Sample Code page of the Technet Web site, or tried searching the Ask tom Web site, or MetaLink?
    Good Luck,
    Avi.

  • How to save a fmb in the database thru command prompt?

    Hi,
    How to save a fmb in the database thru command prompt?
    I have around 25 fmb template files which needs to be saved in the database.Every time when we apply the new dump , we need to resave the templates in the database to compile other application related fmb files.Its a time consuming process and Monotonous for me. Is there anyway to save the forms in the database thru batch file, so that just I have to execute the batch file every time.
    Expecting your earliest feedback.
    Thanks & Regards,
    G.S -
    [email protected] / [email protected]

    Hi Frank,
    Thanks for your feeback.
    I am using forms6i.Basically our application was migrated from 4.5 to 6i two years back. Due to some reasons our technical team members are insisting us to store the template FMB's into the database to do the coding activities at site.
    Once in a month we are receiving the live dump for test database.Hence the problem.
    Please suggest the easiest way to store the template FMBs in the database.
    Thanks & Regards,
    G.S

  • How to store a signature file in database oracle 8.0

    hai,
    please send a sample code how to store a signature stored in a flat file a.gif,b.tif into oracle database please send me the script to [email protected]
    please help me any one

    Hi,
    Read the Articles in the Documentation regarding BFILE. There is a Beautiful example on the docs.
    You can also BLOBS to store these images in the database.
    Best of Luck.
    regards,
    Ganesh R

  • How to search a string from the database?

    how to search a string from the database? starting with some character

    If you're trying to do this in a SELECT, you can use the LIKE verb in your WHERE clause.
    Here's an Example
      SELECT obj_name FROM tadir
        INTO prog
        WHERE pgmid = 'R3TR'
          AND object = 'PROG'
          AND obj_name LIKE 'Z%'.
    In this case it will select every row that obj_name starts with Z. 
    If you wanted to find every row that the field obj_name contains say... 'WIN'  you use LIKE '%WIN%'.
    Edited by: Paul Chapman on Apr 22, 2008 12:32 PM

  • How to generate Java objects from XML files with out  scema compilation

    Dear participants,
    My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of structures are there. i want a generic solution. Please Help.
    Thanks ,
    Raghavendra Ach
    you can mail me to " [email protected]"

    georgemc wrote:
    You could also look at something like Apache Digester, which will parse your XML and populate Java objects with the data. A slightly steeper learning curve than the lower-level APIs such as JDOM, but that's outweighed by the lesser development effortdon't think that would work for the original problem, which seemed to indicate that the xml had an unknown structure.

  • How to create an object within the same class???

    hi im just a newbie
    i v been always creating an object from the main class..
    but how to create an object inside the same class??
    i got main and students class
    the main got an array
    Students[] stu = new Students[]
    and i got
    stu[i] = new Students(id,name);
    i++;
    but i wanna do these things inside the Students class..
    i tried ..but i got errors.....
    how to do this
    .

    javaexpert, :)
    I really have no idea what you are trying to do since you say you've always been creating an object from the main class, yet you always want to create an object inside the same class.
    I'll assume that you have an object in the main class that you are trying to access from the Students class.
    If you are trying to access objects that are contained within the main class FROM the Students class, then know that there are two ways of doing so, one being static, and the other dynamic (look up definitions if unclear):
    1.) make the objects in the main class both static and public and access the the objects using a convention similiar to: Main.object; It's important to note that Main is the name of your main class, and object is a static object. There are better ways of doing this by using gettter/setter methods, but I'll omit that tutorial.
    2.) Create a new instance of the main class and access the objects using a similiar fashion: Main myInstance = new Main(); myInstance.myObject;
    You should really use getter and setter methods but I'll omit the code. In terms of which approach is better, step one is by far.
    I don't mean to be condecending, but you should really brush up on your programming skills before posting to this forum. This is a fundamenetal concept that you will encounter time and time again.

  • How to know which table in the database a form is accessing

    Actually Im new to oracle applications,
    Im getting an error when i open a form from system administrator responsibility saying that table doesnot exist.
    My basic doubt is, how to know which table in the database a form is accessing.
    Any response is higly appreciated.
    Thanks,
    Praveen
    Edited by: user10239520 on Sep 10, 2008 7:07 AM

    Take a look at the following thread:
    Is there a query log in EBS?
    Re: Is there a query log in EBS?

  • How to select alternate entries from the database table

    Hi Experts,
    can u help me, how to select alternate entries from the database table.
    Thanks

    As there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
    What table do you have in mind, what data does it hold, and why do you want alternate records?
    matt

Maybe you are looking for