Thread: java_objects and create table

java_objects and create table

From
Andrew Hart
Date:
I am trying to store a java_object into a database using code:
try {
   s.executeUpdate( "create table regions2 ( region java_object );"  );
}
catch (SQLException e) {
   System.out.println("Error creating:" + e.getMessage());
}


Error creating:ERROR:  Unable to locate type name 'java_object' in catalog
JDK14 pg73jdbc3 pg7.2.1

What is going wrong?  I would assume that the java_object type is not
supported but is there an alternative type so that I can use a prepared
statement and a setObject( myRegion ) call to add my object to the database?

Re: java_objects and create table

From
Paul Thomas
Date:
On 29/08/2003 16:02 Andrew Hart wrote:
> I am trying to store a java_object into a database using code:
> try {
>    s.executeUpdate( "create table regions2 ( region java_object );"  );
> }
> catch (SQLException e) {
>    System.out.println("Error creating:" + e.getMessage());
> }
>
>
> Error creating:ERROR:  Unable to locate type name 'java_object' in
> catalog
> JDK14 pg73jdbc3 pg7.2.1
>
> What is going wrong?  I would assume that the java_object type is not
> supported but is there an alternative type so that I can use a prepared
> statement and a setObject( myRegion ) call to add my object to the
> database?

AFAIK, there's no such data type as java_object and I'm not sure how you
would be led to believe otherwise. It might be possible to serialize your
object abd store it as a Large Object (see section 8.6 Storing Binary Data
in your PostgrSQL docs).

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+