Thread: JAVA_OBJECT: Unkown type

JAVA_OBJECT: Unkown type

From
Julian Hagenauer
Date:
Hi,
i am using java1.5.0 and postgres8.2dev-503
I am trying to store a Java-Object from within a Javaprogramm by calling
'ps.setObject(2,myObject,java.sql.Types.JAVA_OBJECT);'

Unfortuntely this results in:
org.postgresql.util.PSQLException: unkown type: 2.000.
        at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1680)
        at org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1435)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1686)

what is the reason for that? What do i have to do, to get rid of that?

Thank you,
Julian

Re: JAVA_OBJECT: Unkown type

From
Julian Hagenauer
Date:
> i am using java1.5.0 and postgres8.2dev-503

Sorry, i meant postgres8.2dev-503.jdbc3

Sincerely,
Julian

Re: JAVA_OBJECT: Unkown type

From
"Michael Swierczek"
Date:
> On 8/27/06, Julian Hagenauer <chaosbringer@gmx.de> wrote:
> Hi,
> i am using java1.5.0 and postgres8.2dev-503
> I am trying to store a Java-Object from within a Javaprogramm by calling
'ps.setObject(2,myObject,java.sql.Types.JAVA_OBJECT);'
>
> Unfortuntely this results in:
> org.postgresql.util.PSQLException: unkown type: 2.000.
>         at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1680)
>         at org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1435)
>         at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1686)
>
> what is the reason for that? What do i have to do, to get rid of that?
>
> Thank you,
> Julian
>

> On 8/27/06, Julian Hagenauer <chaosbringer@gmx.de> wrote:
> Hi,
> i am using java1.5.0 and postgres8.2dev-503
> I am trying to store a Java-Object from within a Javaprogramm by calling
'ps.setObject(2,myObject,java.sql.Types.JAVA_OBJECT);'
>
> Unfortuntely this results in:
> org.postgresql.util.PSQLException: unkown type: 2.000.
>         at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1680)
>         at org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1435)
>         at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1686)
>
> what is the reason for that? What do i have to do, to get rid of that?
>
> Thank you,
> Julian
>

I don't have much to offer.  If you download the JDBC driver source from
http://jdbc.postgresql.org/download/postgresql-jdbc-8.2dev-503.src.tar.gz
you may be able to figure out the problem yourself.  I only found
references to JAVA_OBJECT in some comments in
org/postgresql/jdbc3/AbstractJdbc3Statement.java
The workhorse function setObject is in
org/postgresql/jdbc2/AbstractJdbc2Statement.java and I don't see an
explicit reference to JAVA_OBJECT in there.

I'm no expert, but if I wanted to save and load Java classes from the
database I would make the class serializable and store and load the
serialized version as a BLOB.  Or are you seeking some other
functionality?

-Mike Swierczek

Re: JAVA_OBJECT: Unkown type

From
Julian Hagenauer
Date:
> >
>
> I don't have much to offer.  If you download the JDBC driver source from
> http://jdbc.postgresql.org/download/postgresql-jdbc-8.2dev-503.src.tar.gz
> you may be able to figure out the problem yourself.  I only found
> references to JAVA_OBJECT in some comments in
> org/postgresql/jdbc3/AbstractJdbc3Statement.java
> The workhorse function setObject is in
> org/postgresql/jdbc2/AbstractJdbc2Statement.java and I don't see an
> explicit reference to JAVA_OBJECT in there.
>
> I'm no expert, but if I wanted to save and load Java classes from the
> database I would make the class serializable and store and load the
> serialized version as a BLOB.  Or are you seeking some other
> functionality?

Hi,
that is exactly how i am doing it rigth now. I though of storing java_objects as a more uper-level implentation, but i
canlife with serialization too :-) 
Thanks,
Julian