Thread: downloading image blobs
Hello, I am having a similary problem that I was having when I was trying to upload an image to the database. I am already able to upload blobs into the database but I cannot download them. I get the error 'inv_open: large object 12992 not found', which I assume means that the statement should be in a transaction, but it is and it still outputs the error. Here is my code: con.setAutoCommit(false); Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery("select image from userpreferences where username='"+user+"'"); if(rs == null) return null; rs.next(); InputStream is = rs.getBinaryStream("image"); <----- This is where the error is thrown JimiReader reader = Jimi.createJimiReader(is); image = reader.getImage(); con.commit(); con.close(); return new ServerMessage(new JimiImageSerializer(image)); Here is my error stack trace: FastPath call returned ERROR: inv_open: large object 12992 not found at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:126) at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:176) at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:188) at org.postgresql.largeobject.LargeObject.<init>(LargeObject.java:89) at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:134) at org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:437) at org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:544) at org.opensimpx.server.RequestHandler.getBackgroundImage(RequestHandler.java:688) at org.opensimpx.server.RequestHandler.handleRequest(RequestHandler.java:440) at org.opensimpx.server.RequestHandler.run(RequestHandler.java:221) at java.lang.Thread.run(Thread.java:479) Any ideas? Thank you in advanced, Matt
hello. the only time i remember seeing this error was after creating a new db from a pg_dump...obviously it didn't copy the blobs, only the references to them. so the db had a reference to something that didn't exist. chris -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Matt Fair Sent: Tuesday, September 25, 2001 12:21 PM To: pgsql-jdbc@postgresql.org Subject: [JDBC] downloading image blobs Hello, I am having a similary problem that I was having when I was trying to upload an image to the database. I am already able to upload blobs into the database but I cannot download them. I get the error 'inv_open: large object 12992 not found', which I assume means that the statement should be in a transaction, but it is and it still outputs the error. Here is my code: con.setAutoCommit(false); Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery("select image from userpreferences where username='"+user+"'"); if(rs == null) return null; rs.next(); InputStream is = rs.getBinaryStream("image"); <----- This is where the error is thrown JimiReader reader = Jimi.createJimiReader(is); image = reader.getImage(); con.commit(); con.close(); return new ServerMessage(new JimiImageSerializer(image)); Here is my error stack trace: FastPath call returned ERROR: inv_open: large object 12992 not found at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:126) at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:176) at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:188) at org.postgresql.largeobject.LargeObject.<init>(LargeObject.java:89) at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:1 34) at org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:437) at org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:544) at org.opensimpx.server.RequestHandler.getBackgroundImage(RequestHandler.java:6 88) at org.opensimpx.server.RequestHandler.handleRequest(RequestHandler.java:440) at org.opensimpx.server.RequestHandler.run(RequestHandler.java:221) at java.lang.Thread.run(Thread.java:479) Any ideas? Thank you in advanced, Matt ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Matt, Have you verified that this large object (id=12992) exists in your database? (select distinct loid from pg_largeobject where loid = 12992) If it doesn't, I think then the place to look is the code that you used to insert the large objects as it would appear that code didn't do the insert correctly (or some other code as since deleted the large object). thanks, --Barry Matt Fair wrote: > Hello, > I am having a similary problem that I was having when I was trying to > upload an image to the database. I am already able to upload blobs into > the database but I cannot download them. > I get the error 'inv_open: large object 12992 not found', which I assume > means that the statement should be in a transaction, but it is and it > still outputs the error. > Here is my code: > con.setAutoCommit(false); > Statement statement = con.createStatement(); > ResultSet rs = statement.executeQuery("select image from > userpreferences where username='"+user+"'"); > if(rs == null) return null; > rs.next(); > InputStream is = rs.getBinaryStream("image"); <----- This is > where the error is thrown > JimiReader reader = Jimi.createJimiReader(is); > image = reader.getImage(); > con.commit(); > con.close(); > return new ServerMessage(new JimiImageSerializer(image)); > Here is my error stack trace: > FastPath call returned ERROR: inv_open: large object 12992 not found > > at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:126) > at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:176) > at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:188) > at > org.postgresql.largeobject.LargeObject.<init>(LargeObject.java:89) > at > org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:134) > > at > org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:437) > at > org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:544) > at > org.opensimpx.server.RequestHandler.getBackgroundImage(RequestHandler.java:688) > > at > org.opensimpx.server.RequestHandler.handleRequest(RequestHandler.java:440) > at org.opensimpx.server.RequestHandler.run(RequestHandler.java:221) > at java.lang.Thread.run(Thread.java:479) > > Any ideas? > Thank you in advanced, > Matt > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >