X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 28BB03A42B7 for ; Sun, 31 Oct 2004 20:30:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70105-09 for ; Sun, 31 Oct 2004 20:30:01 +0000 (GMT) Received: from ms-dienst.rz.rwth-aachen.de (ms-1.rz.RWTH-Aachen.DE [134.130.3.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7C6A93A42A4 for ; Sun, 31 Oct 2004 20:30:00 +0000 (GMT) Received: from r220-1 (r220-1.rz.RWTH-Aachen.DE [134.130.3.31]) by ms-dienst.rz.rwth-aachen.de (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0I6G00D4RU9Z36@ms-dienst.rz.rwth-aachen.de> for pgsql-jdbc@postgresql.org; Sun, 31 Oct 2004 21:29:59 +0100 (MET) Received: from relay.rwth-aachen.de ([134.130.3.1]) by r220-1 (MailMonitor for SMTP v1.2.2 ) ; Sun, 31 Oct 2004 21:29:58 +0100 (MET) Received: from post.halifax.rwth-aachen.de (post.halifax.RWTH-Aachen.DE [134.130.49.251]) by relay.rwth-aachen.de (8.13.0/8.13.0/1) with ESMTP id i9VKTwxb009168 for ; Sun, 31 Oct 2004 21:29:58 +0100 (MET) Received: (qmail 20465 invoked from network); Sun, 31 Oct 2004 20:30:05 +0000 Received: from darkenemy.halifax.rwth-aachen.de ([134.130.48.36]) (envelope-sender ) by mail.halifax.rwth-aachen.de (qmail-ldap-1.03) with SMTP for ; Sun, 31 Oct 2004 20:30:05 +0000 Date: Sun, 31 Oct 2004 21:29:57 +0100 From: Ulrich Meis Subject: Re: persistence of java objects In-reply-to: To: jessica xingzc_he Cc: pgsql-jdbc@postgresql.org Message-id: <200410312129.57710.kenobi@halifax.rwth-aachen.de> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: KMail/1.7 References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/317 X-Sequence-Number: 11422 On Sunday 31 October 2004 01:05, jessica xingzc_he wrote: > hi, > > Does postgresql support this? if i want a column of a table for the > persistence of instance of java objects, and use ResultSet.getObject() and > ResultSet.updateObjecct() to access them. if so, what data type the column > should be? If you use a standard type like integer or varchar, you can do things like setObject(1,new Integer(5)); setObject(2,"something"); which would be equivalent to setInteger(1,new Integer(5)); setString(2,"something"); If you want to store complex objects in the database then they should implement the java.io.serializable interface. Thereby you can store them in a byteArray or push them into a bytearraystream and write the result with the usual methods into the database. A simple serialization example is here for java.io.File: http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/examples.doc1.html Regards, Uli