Home > large objects > org.postgresql.util.psqlexception error invalid large-object descriptor

Org.postgresql.util.psqlexception Error Invalid Large-object Descriptor

here for a quick overview of the site Help Center Detailed answers to large objects may not be used in auto-commit mode postgres any questions you might have Meta Discuss the workings and org.hibernate.exception.genericjdbcexception: large objects may not be used in auto-commit mode. policies of this site About Us Learn more about Stack Overflow the company Business Learn more sql error: 0, sqlstate: 25p01 about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Large Objects may not be used in auto-commit mode up vote 12 down vote favorite 3 I have a Spring application which uses Hibernate on a PostgreSQL database. I'm trying to store files in a table of the database. It seems it stores the row with the file (I just use persist method on EntityManager), but when the object is loaded from the database I get the following exception: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode. To load the data I'm using a MultipartFile transient atribute and in its setter I'm setting the information I want to persist (byte[], fileName, size). The entity I'm persisting looks like this one (I've ommitted the rest of getters/setters): @Entity @Table(name="myobjects") public class MyClass { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sequence") @SequenceGenerator(name="sequence", sequenceName="myobjects_pk_seq", allocationSize=1) @Column(name="id") private Integer id; @Lob private String description; @Temporal(TemporalType.TIMESTAMP) private Date creationDate; @Transient private MultipartFile multipartFile; @Lob @Basic(fetch=FetchType.LAZY, optional=true) byte[] file; String fileName; String fileContentType; Integer fileSize; public void setMultipartFile(MultipartFile multipartFile) { this.multipartFile = multipartFile; try { this.file = this.multipartFile.getBytes(); this.fileName = this.multipartFile.getOriginalFilename(); this.fileContentType = this.multipartFile.getContentType(); this.fileSize = ((Long) this.multipartFile.ge

pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project lists Inactive lists IRC Local User Groups Featured Users International Sites Propaganda Resources Weekly News Re: Invalid large object descriptor : 0 with autocommit From: "Michael Paesold" To: "aditya Kulkarni" , Subject: Re: Invalid large object descriptor : 0 with http://stackoverflow.com/questions/3164072/large-objects-may-not-be-used-in-auto-commit-mode autocommit Date: 2004-09-18 12:50:21 Message-ID: 002701c49d7e$0f059240$d604460a@zaphod (view raw or whole thread) Thread: 2004-09-16 08:07:09 from aditya Kulkarni 2004-09-18 12:50:21 from "Michael Paesold" Lists: pgsql-general Aditya Kulkarni wrote: > I have an application that ran on Oracle, and the application, for > some reason requires https://www.postgresql.org/message-id/002701c49d7e$0f059240$d604460a@zaphod autocommit to be true. Now, when we moved this > application to postgres, we moved the blob column to LargeObjects. > > But PostgreSQL doesn't seem to be able to use Large Objects with > autoCommit = true. Is there any other way to work around this problem > ? Large objects access only works inside transactions. Workaround: use bytea datatype for blob instead of large objects http://www.postgresql.org/docs/7.4/static/datatype-binary.html Best Regards, Michael Paesold In response to Invalid large object descriptor : 0 with autocommit at 2004-09-16 08:07:09 from aditya Kulkarni pgsql-general by date Next:From: Marc G. FournierDate: 2004-09-18 13:39:03 Subject: Re: Mail delivery failed: returning message to sender Previous:From: Russell SmithDate: 2004-09-18 08:57:11 Subject: Re: Mail delivery failed: returning message to sender Privacy Policy | About PostgreSQL Copyright © 1996-2016 The PostgreSQL Global Development Group

Regional lists Associations User groups Project lists pgadmin-hackers pgadmin-support pgsql-jdbc pgsql-odbc pgsql-pkg-debian pgsql-pkg-yum psycopg Inactive lists IRC Local User Groups Featured Users International Sites Propaganda Resources Weekly News https://www.postgresql.org/message-id/5.2.1.1.0.20030826201150.00b6e250@mail.flirble.org Help - lo_close: invalid large obj descriptor From: Toby To: https://www.postgresql.org/message-id/39D8DAB9.35A9F517@radix.com.br pgsql-jdbc(at)postgresql(dot)org Subject: Help - lo_close: invalid large obj descriptor Date: 2003-08-26 19:37:57 Message-ID: 5.2.1.1.0.20030826201150.00b6e250@mail.flirble.org (view raw or whole thread) Thread: 2003-08-26 18:56:26 from Juan Francisco Diaz 2003-08-26 19:37:57 from Toby 2003-08-27 19:36:24 from Barry Lind 2003-08-28 01:31:39 from Oliver Jowett 2003-08-28 12:25:55 large objects from Toby Doig 2003-08-28 17:21:15 from Barry Lind 2003-08-29 13:55:18 from Toby Doig 2003-08-28 17:30:30 from Barry Lind 2003-08-27 19:39:07 from Barry Lind Lists: pgsql-jdbc I've read the docs, I've searched the web. I'm running PGSql 7.3.4 under Cygwin 1.3.22.1, J2SE 1.4.2, latest stable JDBC v3 drivers (pg73jdbc3.jar). This is all running on large objects may the same machine, a dual AMD with 1GB memory. Accessing the database works fine, but when I try to write to a newly created LargeObject it always fails with org.postgresql.util.PSQLException - FastPath call returned ERROR: lo_write: invalid large obj descriptor (0) The code below illustrates this. The code is actually going to be used within a Tomcat webapp, but I had to use Jdbc3ConnectionPool since that was the only pool that returned connections that were castable to a PGConnection. I get the same error from inside and outside Tomcat. Thought the error might be related to permissions writing large objects so I tried the following which didn't help. GRANT ALL ON "pg_largeobject" TO "web"; I also tried not using the connection pool, and instead just using the straight DriverManager.getConnection() instead, but that fails on the lo.write() call too. I've had large objects working fine on another project (same dev machine) a coupla years ago (pg 7.2.x), so I don't think its a case of HOW I'm doing it, I suspect there's a

pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project lists Inactive lists IRC Local User Groups Featured Users International Sites Propaganda Resources Weekly News Re: JDBC and LO - invalid large object descriptor From: Nelson Ferreira Jr To: Dnesbitt(at)encryptix(dot)com, pgsql-interfaces(at)postgresql(dot)org Subject: Re: JDBC and LO - invalid large object descriptor Date: 2000-10-02 18:58:01 Message-ID: 39D8DAB9.35A9F517@radix.com.br (view raw or whole thread) Thread: 2000-09-29 02:20:55 from Dnesbitt(at)encryptix(dot)com 2000-10-02 18:58:01 from Nelson Ferreira Jr Lists: pgsql-interfaces I also got these errors even doing conn.setAutoCommit(false); in a high-load enviroment. The solution is that you have to do a conn.commit(); after acessing the BLOB (even if you're only reading data) []'s Dnesbitt(at)encryptix(dot)com wrote: > Andreas, > > Are you doing the following prior to your executeQuery() method call? > > conn.setAutoCommit(false); > > If not, then I think that may be your problem. It may seem weird to do a > query in a transaction, but that is how it works. > > Regards, > //Dave > > > -----Original Message----- > > From: Andreas Vogler [mailto:Andreas(dot)Vogler(at)geneon(dot)de] > > Sent: Sunday, September 24, 2000 6:29 AM > > To: pgsql-interfaces(at)postgresql(dot)org > > Subject: [INTERFACES] JDBC and LO - invalid large object descriptor > > > > > > Hi, > > > > I have got a problem with reading large objects from Postgres > > through JDBC > > (both 7.0.2): > > a call to resultset.getBytes(...) results in: > > > > FastPath call returned ERROR: lo_tell: invalid large object > > descriptor (0) > > at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:141) > > at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:191) > > at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:203) > > at org.postgresql.largeobject.LargeObject.tell(LargeObject.java:232) > > at org.postgresql.largeobject.LargeObject.size(LargeObject.java:247) > > at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:370) > > > > using "select lo_export(...)" is no problem, so I suppose the > > data is stored > > correctly within the DB. > > Any i

 

Related content

org.postgresql.util.psqlexception error invalid large-object descriptor 0

Org postgresql util psqlexception Error Invalid Large-object Descriptor table id toc tbody tr td div id toctitle Contents div ul li a href Large Objects May Not Be Used In Auto-commit Mode Postgres a li ul td tr tbody table p Red Hat Inc All rights reserved JBoss and Hibernate are registered trademarks and servicemarks of Red Hat Inc p p pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php relatedl pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project lists Inactive lists IRC Local User Groups Featured Users International Sites Propaganda Resources Weekly News Re Invalid large object

psqlexception error invalid large-object descriptor 0

Psqlexception Error Invalid Large-object Descriptor table id toc tbody tr td div id toctitle Contents div ul li a href Org hibernate exception genericjdbcexception Large Objects May Not Be Used In Auto-commit Mode a li ul td tr tbody table p Red Hat Inc All rights reserved JBoss and Hibernate are registered trademarks and servicemarks of Red Hat Inc p p here for a quick overview of the site Help Center Detailed answers to any relatedl questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn