Results 1 to 3 of 3
- 10-10-2009, 07:25 PM #1
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
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.
- 10-10-2009, 08:44 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 10-11-2009, 12:31 PM #3
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
How to write a java bean class object to XML file
By Java Tip in forum java.ioReplies: 1Last Post: 01-29-2009, 09:35 AM -
How to Load Java Object into Oracle Database
By dorairaj in forum Advanced JavaReplies: 3Last Post: 01-12-2009, 02:37 PM -
Advantages and disadvantages of storing java object to database
By archanab in forum Advanced JavaReplies: 10Last Post: 12-23-2008, 07:37 PM -
How to insert java Object in oracle database
By Thilkumar82 in forum Advanced JavaReplies: 9Last Post: 08-13-2008, 11:33 AM -
Method to write if the string object can be converted to Integer or not.
By Abhishek in forum New To JavaReplies: 4Last Post: 03-25-2008, 12:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks