Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Storing objects [Q]

2 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-05-27 19:26:14.0Z
Michiel Veen Posted on 1997-05-27 06:23:23.0Z
Message-ID: <338A7DDB.1CFA@tcf.nl>
Date: Tue, 27 May 1997 08:23:23 +0200
From: Michiel Veen <michiel@tcf.nl>
Reply-To: michiel@tcf.nl
Organization: The Connection Factory
X-Mailer: Mozilla 3.01 (WinNT; I)
MIME-Version: 1.0
Subject: Storing objects [Q]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 7
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:772
Article PK: 252526

Hi,

Is it possible to store a java object like java.awt.color in the
database?

We did some experimenting with serialization but until now no result

Regards Michiel

--

#-- michiel@tcf.nl
#-- The Connection Factory b.v.
#-- http://www.tcf.nl


David Clegg Posted on 1997-05-27 19:26:14.0Z
Message-ID: <338B3556.2E2BF5F2@sybase.com>
Date: Tue, 27 May 1997 12:26:14 -0700
From: David Clegg <davec@sybase.com>
X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i586)
MIME-Version: 1.0
To: michiel@tcf.nl
Subject: Re: Storing objects [Q]
References: <338A7DDB.1CFA@tcf.nl>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 46
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:763
Article PK: 252517

You can store java objects in "image" columns. There is no direct
support for doing this with JDBC or jConnect.
The PreparedStatement.writeObject() method may eventually be extended
to explicitly support this -- and the ResultSet.getObject() method
may be extended to de-serialize, but both of these features are
only being considered in a future JDBC standard.
jConnect doesn't necessarily have to await a standard to make this
support possible, but we have a number of issues to resolve with
how much the SQL Server needs to know about this datatype to make
it useful. Are the objects fully serialized - including their
bytecode implementations, or are they simply externalized -- implying
that there is some way to separately find the bytecode associated
with the class which the externalized object is a member of...

If you can create an ObjectInputStream for the object you want to
store, you can pass it to PreparedStatement.setBinaryStream() and
jConnect will store it in an image column. Likewise, if you select
it back through ResultSet.getBinaryStream() and use the InputStream
we return as a constructor for an ObjectInputStream() you should
be able to get the object back.

Good luck, and let us all know how it goes.

Also - please forward any ideas on what if anything you would like
to be able to do with these "stored" objects once they are on the
server. We are deeply involved with designing this stuff for the
"Adaptive Server" products which Sybase announced recently.

dave

> Hi,
>
> Is it possible to store a java object like java.awt.color in the
> database?
>
> We did some experimenting with serialization but until now no result
>
> Regards Michiel
>
> --
>
> #-- michiel@tcf.nl
> #-- The Connection Factory b.v.
> #-- http://www.tcf.nl