pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC - large objects
5+ messages / 4 participants
[nested] [flat]

* JDBC - large objects
@ 1999-07-06 08:56  Rolland Crunk <rc@crunk.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Rolland Crunk @ 1999-07-06 08:56 UTC (permalink / raw)
  To: pgsql-interfaces



I am having some problem getting the jdbc driver to work properly with
large objects using standard jdbc interfaces.  The tables are pretty much
standard relational tables except for one column that I serialize 
implementations of the java.security.acl.Acl as objects into. 

The error I get is: ERROR:  lo_write: invalid large obj descriptor (0)

This was the same error I got running the blobtest until I applied Tatsuo Ishii's
patch I found in the mailing list archives. I tried the same thing in my code
(turn on explicit transactions when storing a blob) but it doesn't seem to
have any effect.

I have tried defining the acl field in my create table statement as both:

	:	:
	acl	oid,
	:	:

and

	:	:
	acl	char[]
	:	:

And see same thing.

The same (java) code runs fine using Oracle 8 and their thin driver. 

I guess what I need to know is: is what I am trying to do possible using
PostgreSQL/JDBC without using the PostgreSQL extensions? (not an
option for me).  If so, what should I use for serialized columns in the
create table sql statement?  Can it be done without turning off autocommit?

Thanks in advance for any help anyone can provide.

Cordially,

rc

ps: My environment is:

	Solaris 2.7 (intel)
	jdk 1.2 (jdk 1.1 fares no better)
	PostgreSQL 6.5






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* JDBC - large objects
@ 1999-07-06 09:03  Rolland Crunk <rc@aenet.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Rolland Crunk @ 1999-07-06 09:03 UTC (permalink / raw)
  To: pgsql-interfaces



I am having some problem getting the jdbc driver to work properly with
large objects using standard jdbc interfaces.  The tables are pretty much
standard relational tables except for one column that I serialize 
implementations of the java.security.acl.Acl as objects into. 

The error I get is: ERROR:  lo_write: invalid large obj descriptor (0)

This was the same error I got running the blobtest until I applied Tatsuo Ishii's
patch I found in the mailing list archives. I tried the same thing in my code
(turn on explicit transactions when storing a blob) but it doesn't seem to
have any effect.

I have tried defining the acl field in my create table statement as both:

	:	:
	acl	oid,
	:	:

and

	:	:
	acl	char[]
	:	:

And see same thing.

The same (java) code runs fine using Oracle 8 and their thin driver. 

I guess what I need to know is: is what I am trying to do possible using
PostgreSQL/JDBC without using the PostgreSQL extensions? (not an
option for me).  If so, what should I use for serialized columns in the
create table sql statement?  Can it be done without turning off autocommit?

Thanks in advance for any help anyone can provide.

Cordially,

rc

ps: My environment is:

	Solaris 2.7 (intel)
	jdk 1.2 (jdk 1.1 fares no better)
	PostgreSQL 6.5



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: [INTERFACES] JDBC - large objects
@ 1999-07-06 11:36  Peter Mount <petermount@it.maidstone.gov.uk>
  0 siblings, 0 replies; 5+ messages in thread

From: Peter Mount @ 1999-07-06 11:36 UTC (permalink / raw)
  To: 'Rolland Crunk' <rc@aenet.net>; pgsql-interfaces

Could I see the section of your code that has this problem?

For the stock JDBC methods to access a large object, you would need your
acl field to be of type oid, otherwise the driver will not recognise it
as a blob.

Also, as of 6.5, autocommit must be turned off, as large objects can
only be accessed from within a transaction.

I presume you are using the 6.5 version of the driver?

Peter

-- 
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.



-----Original Message-----
From: Rolland Crunk [mailto:rc@aenet.net]
Sent: 06 July 1999 10:04
To: pgsql-interfaces@postgreSQL.org
Subject: [INTERFACES] JDBC - large objects




I am having some problem getting the jdbc driver to work properly with
large objects using standard jdbc interfaces.  The tables are pretty
much
standard relational tables except for one column that I serialize 
implementations of the java.security.acl.Acl as objects into. 

The error I get is: ERROR:  lo_write: invalid large obj descriptor (0)

This was the same error I got running the blobtest until I applied
Tatsuo Ishii's
patch I found in the mailing list archives. I tried the same thing in my
code
(turn on explicit transactions when storing a blob) but it doesn't seem
to
have any effect.

I have tried defining the acl field in my create table statement as
both:

	:	:
	acl	oid,
	:	:

and

	:	:
	acl	char[]
	:	:

And see same thing.

The same (java) code runs fine using Oracle 8 and their thin driver. 

I guess what I need to know is: is what I am trying to do possible using
PostgreSQL/JDBC without using the PostgreSQL extensions? (not an
option for me).  If so, what should I use for serialized columns in the
create table sql statement?  Can it be done without turning off
autocommit?

Thanks in advance for any help anyone can provide.

Cordially,

rc

ps: My environment is:

	Solaris 2.7 (intel)
	jdk 1.2 (jdk 1.1 fares no better)
	PostgreSQL 6.5



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [INTERFACES] JDBC - large objects
@ 1999-07-07 08:30  Rolland Crunk <rc@accentuate.com>
  parent: Rolland Crunk <rc@aenet.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Rolland Crunk @ 1999-07-07 08:30 UTC (permalink / raw)
  To: pgsql-interfaces


Update. This particular problem is resolved. Here what it was:

The failing code as per my original posting went something like this:

	PreparedStatement statement = conn.prepareStatement("...");
		:		:
	//  add values to the prepared statement
		:		:
	conn.setAutoCommit(false);
	statement.executeUpdate("...");
	conn.commit();

When I changed it to go something like this:

	conn.setAutoCommit(false);
	PreparedStatement statement = conn.prepareStatement("...");
		:		:
	//  add values to the prepared statement
		:		:
	statement.executeUpdate("...");
	conn.commit();

The "ERROR:  lo_write: invalid large obj descriptor (0)" problem went away.

To summarize, autocommit needs to be turned off prior to statement creation.
(at least for prepared statements).

rc

At 02:03 AM 7/6/99 -0700, Rolland Crunk wrote:
>
>
>I am having some problem getting the jdbc driver to work properly with
>large objects using standard jdbc interfaces.  The tables are pretty much
>standard relational tables except for one column that I serialize 
>implementations of the java.security.acl.Acl as objects into. 
>
>The error I get is: ERROR:  lo_write: invalid large obj descriptor (0)
>
>This was the same error I got running the blobtest until I applied Tatsuo 
>Ishii's
>patch I found in the mailing list archives. I tried the same thing in my code
>(turn on explicit transactions when storing a blob) but it doesn't seem to
>have any effect.
>
>I have tried defining the acl field in my create table statement as both:
>
>	:	:
>	acl	oid,
>	:	:
>
>and
>
>	:	:
>	acl	char[]
>	:	:
>
>And see same thing.
>
>The same (java) code runs fine using Oracle 8 and their thin driver. 
>
>I guess what I need to know is: is what I am trying to do possible using
>PostgreSQL/JDBC without using the PostgreSQL extensions? (not an
>option for me).  If so, what should I use for serialized columns in the
>create table sql statement?  Can it be done without turning off autocommit?
>
>Thanks in advance for any help anyone can provide.
>
>Cordially,
>
>rc
>
>ps: My environment is:
>
>	Solaris 2.7 (intel)
>	jdk 1.2 (jdk 1.1 fares no better)
>	PostgreSQL 6.5




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [INTERFACES] JDBC - large objects
@ 1999-07-07 08:48  Rolland Crunk <rc@aenet.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Rolland Crunk @ 1999-07-07 08:48 UTC (permalink / raw)
  To: pgsql-interfaces



Update. This particular problem is resolved. Here what it was:

The failing code as per my original posting went something like this:

	PreparedStatement statement = conn.prepareStatement("...");
		:		:
	//  add values to the prepared statement
		:		:
	conn.setAutoCommit(false);
	statement.executeUpdate("...");
	conn.commit();

When I changed it to go something like this:

	conn.setAutoCommit(false);
	PreparedStatement statement = conn.prepareStatement("...");
		:		:
	//  add values to the prepared statement
		:		:
	statement.executeUpdate("...");
	conn.commit();

The "ERROR:  lo_write: invalid large obj descriptor (0)" problem went away.

To summarize, autocommit needs to be turned off prior to statement creation.
(at least for prepared statements).

rc

At 02:03 AM 7/6/99 -0700, Rolland Crunk wrote:
>
>
>I am having some problem getting the jdbc driver to work properly with
>large objects using standard jdbc interfaces.  The tables are pretty much
>standard relational tables except for one column that I serialize 
>implementations of the java.security.acl.Acl as objects into. 
>
>The error I get is: ERROR:  lo_write: invalid large obj descriptor (0)
>
>This was the same error I got running the blobtest until I applied Tatsuo 
>Ishii's
>patch I found in the mailing list archives. I tried the same thing in my code
>(turn on explicit transactions when storing a blob) but it doesn't seem to
>have any effect.
>
>I have tried defining the acl field in my create table statement as both:
>
>	:	:
>	acl	oid,
>	:	:
>
>and
>
>	:	:
>	acl	char[]
>	:	:
>
>And see same thing.
>
>The same (java) code runs fine using Oracle 8 and their thin driver. 
>
>I guess what I need to know is: is what I am trying to do possible using
>PostgreSQL/JDBC without using the PostgreSQL extensions? (not an
>option for me).  If so, what should I use for serialized columns in the
>create table sql statement?  Can it be done without turning off autocommit?
>
>Thanks in advance for any help anyone can provide.
>
>Cordially,
>
>rc
>
>ps: My environment is:
>
>	Solaris 2.7 (intel)
>	jdk 1.2 (jdk 1.1 fares no better)
>	PostgreSQL 6.5




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~1999-07-07 08:48 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-07-06 08:56 JDBC - large objects Rolland Crunk <rc@crunk.net>
1999-07-06 09:03 JDBC - large objects Rolland Crunk <rc@aenet.net>
1999-07-07 08:30 ` Rolland Crunk <rc@accentuate.com>
1999-07-06 11:36 RE: [INTERFACES] JDBC - large objects Peter Mount <petermount@it.maidstone.gov.uk>
1999-07-07 08:48 Re: [INTERFACES] JDBC - large objects Rolland Crunk <rc@aenet.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox