×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT杂谈 / Jabber , how can I save a object like hashtable in Java into database for further use ??!! It's urgent . Many thanks in advance .
    • Just some vague hints
      Your question is two big. I don't think I can give a satisfactory answer.

      Of course, you need use JDBC.

      It is difficult to save an object into a database. Database can only save numbers, chars (String in Java), Blobs ... If you have an object, you need to express it in numbers, Strings, Iamges...before you store it into database.

      Can you save(serialize) your objects into files?

      Good luck.
    • you can use object database
      unlike a relational database, an object database can be used to store objects and their relationships directly. There are several commercial object database. ObjectStore is one of them. it has JAVA and c++ API. You can even download a free version (ObjectStore PSE) from its website.
      • Right now, mots Object databases are just a wrapper of relational databases...
    • good question
      • Yes, you know , in Perl , there is a module that can save a hashtable into string and physically file on HD . and you can retrieve back the hashtable anytime .
        Yes, you know , in Perl , there is a module that can save a hashtable into string and physically file on HD . and you can retrieve back the hashtable anytime .
        Can we do it with Java ??
    • Good question, I think when you write, you can serialized the object in a file and save the file into database, when you read, you can deserialized the file to object.
      Or there you can use XML to describe the object and save the XML in database field, after you read the XML out , you can parse the XML with the object
      The defect is you need load the object template after/before you read /write into database