Re: [INTERFACES] storing java objects
От | Peter T Mount |
---|---|
Тема | Re: [INTERFACES] storing java objects |
Дата | |
Msg-id | Pine.LNX.4.04.9907010636310.31519-100000@maidast.retep.org.uk обсуждение исходный текст |
Ответ на | storing java objects (Nathan Gelbard <gelbardn@intus.net>) |
Список | pgsql-interfaces |
On Wed, 30 Jun 1999, Nathan Gelbard wrote: > Solaris 2.6, Java 1.2, postgresql 6.4.2. First, you'll need the 6.5 driver to get it to work with JDK1.2. It will work with 6.4.2 > I noticed getObject/setObject functions in the API, and would like to > store java objects in my psql DB. Is this possible? Yes. > how do i define a table that holds java.sql.Types.JAVA.OBJECT s? There's two methods in the API. 1. Define a class that extends postgresql.util.PGObject, then register it with postgresql.Connection. This allows you to implement new datatypes. Take a look at the postgresql.geom sub-package. 2. Make any of your objects Serialisable. Then call the create() method in postgresql.util.Serialise. This will create thenecessary tables for the object. There's extensive notes on how to do #2 in the source to the postgresql.util.Serialise class. > Is there any example code laying around to do this? I thought I did write an example, but it's not there. I'll go and look for it. Peter -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf
В списке pgsql-interfaces по дате отправления: