pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedCan't get JDBC BLOB online manual example working
2+ messages / 2 participants
[nested] [flat]
* Can't get JDBC BLOB online manual example working
@ 2001-01-06 22:49 Neal Vadekar <nvadekar@netscape.net>
0 siblings, 0 replies; 2+ messages in thread
From: nvadekar@netscape.net @ 2001-01-06 22:49 UTC (permalink / raw)
To: pgsql-interfaces
In the online manual is gives the following eg. on how to access a blob uisng
jdbc:
PreparedStatement ps = con.prepareStatement("select oid from images where
name=keyfield");
ps.setString(1,"myimage.gif");
ResultSet rs = ps.executeQuery();
if(rs!=null) {
while(rs.next()) {
InputStream is = rs.getBinaryInputStream(1);
// use the stream in some way here
is.close();
}
rs.close();
}
ps.close();
I have tried this to no avail. The getBinaryInputStream method is not
available in the packages that are included in the JSP page. I don't know
why, I know the select statement is working, but it only works when I have
the line with getBinaryInputStream commented out. How do I get access to
that method? I am using jdbc7.0.1-2.jar. I thought that by using the jdbc
driver, that method would be available to me???
I tried getBinaryStream, instead of getBinaryInputStream, but then I get the
following error:
javax.servlet.ServletException: FastPath call returned ERROR: Relation 0
does not exist
I then changed everthing to a BLOB object instead of InputStream as follows:
byte[] blob1 = rs1.getBytes("photoblob"); \\photoblob is the name of the field
but I still keep getting the:
javax.servlet.ServletException: FastPath call returned ERROR: Relation 0
does not exist
error. How do I get past this error, it is killing me! What does Relation 0
does not exist mean? What is the FastPath error. Every object and method I
try to use to access the BLOB results in that same error. I am using RedHat
7.0, Postgresql 7.02 and Tomcat 3.2.1.
HELP, and Thanks in advance.
Neal Vadekar
__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at
http://webmail.netscape.com/
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Can't get JDBC BLOB online manual example working
@ 2001-01-06 23:30 Greg Speegle <Greg@10happythings.com>
0 siblings, 0 replies; 2+ messages in thread
From: Greg Speegle @ 2001-01-06 23:30 UTC (permalink / raw)
To: nvadekar@netscape.net; pgsql-interfaces
You have to use getBytes() instead of getBinaryInputStream,
and you have to put everything inside of a transaction. Not
well documented aspects of the PostgreSQL JDBC.
Good luck,
Greg Speegle
1/6/01 5:49:49 PM, nvadekar@netscape.net (Neal Vadekar) wrote:
>In the online manual is gives the following eg. on how to access a blob uisng
>jdbc:
>
>PreparedStatement ps = con.prepareStatement("select oid from images where
>name=keyfield");
>ps.setString(1,"myimage.gif");
>ResultSet rs = ps.executeQuery();
>if(rs!=null) {
> while(rs.next()) {
> InputStream is = rs.getBinaryInputStream(1);
> // use the stream in some way here
> is.close();
> }
> rs.close();
>}
>ps.close();
>
>I have tried this to no avail. The getBinaryInputStream method is not
>available in the packages that are included in the JSP page. I don't know
>why, I know the select statement is working, but it only works when I have
>the line with getBinaryInputStream commented out. How do I get access to
>that method? I am using jdbc7.0.1-2.jar. I thought that by using the jdbc
>driver, that method would be available to me???
>
>I tried getBinaryStream, instead of getBinaryInputStream, but then I get the
>following error:
>
>javax.servlet.ServletException: FastPath call returned ERROR: Relation 0
>does not exist
>
>I then changed everthing to a BLOB object instead of InputStream as follows:
>
>byte[] blob1 = rs1.getBytes("photoblob"); \\photoblob is the name of the field
>
>but I still keep getting the:
>
>javax.servlet.ServletException: FastPath call returned ERROR: Relation 0
>does not exist
>
>error. How do I get past this error, it is killing me! What does Relation 0
>does not exist mean? What is the FastPath error. Every object and method I
>try to use to access the BLOB results in that same error. I am using RedHat
>7.0, Postgresql 7.02 and Tomcat 3.2.1.
>
>HELP, and Thanks in advance.
>
>Neal Vadekar
>
>
>__________________________________________________________________
>Get your own FREE, personal Netscape Webmail account today at
>http://webmail.netscape.com/
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-01-06 23:30 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-01-06 22:49 Can't get JDBC BLOB online manual example working Neal Vadekar <nvadekar@netscape.net>
2001-01-06 23:30 Re: Can't get JDBC BLOB online manual example working Greg Speegle <Greg@10happythings.com>
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