Results 1 to 3 of 3
  1. #1
    rjstanley is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default How do you write a Java object to MSAccess database?

    Hi,

    Let's assume I have an object created in Java from a class called Person with attributes name, address and age.

    How might I write the entire object to a MS-Access table, rather than writing the individual attributes?

    Any help would be appreciated including links to relevant websites, etc.

    Thanks.

    Robin.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Serialise the object to a ByteArrayOutputStream, then store that in a BLOB field.

    Or, use XMLEncoder and write that to a text field. In either case, the object must be serialisable. Of course, the only thing you are saving is having to write a few lines of code yourself. Performance wise, it is almost guaranteed to be slower than simply saving the relevant bits of information. Restoring it through deserialisation will probably also be slower than simply initiating a new object using the bits of information read from the db.

    And, storage-wise it is also, probably, less efficient.

  3. #3
    rjstanley is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default Thanks

    Thank you very much for your help and advice. Much appreciated.

    Robin.

Similar Threads

  1. Replies: 1
    Last Post: 01-29-2009, 09:35 AM
  2. How to Load Java Object into Oracle Database
    By dorairaj in forum Advanced Java
    Replies: 3
    Last Post: 01-12-2009, 02:37 PM
  3. Replies: 10
    Last Post: 12-23-2008, 07:37 PM
  4. How to insert java Object in oracle database
    By Thilkumar82 in forum Advanced Java
    Replies: 9
    Last Post: 08-13-2008, 11:33 AM
  5. Replies: 4
    Last Post: 03-25-2008, 12:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •