I suggest you email the postgresql-jdbc list and ask someone to implement
it. The list is very active and people are usually quite responsive.
-mike
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Julian
Richardson
Sent: Saturday, March 17, 2001 3:56 AM
To: Orion-Interest
Cc: '[EMAIL PROTECTED]'
Subject: RE: Orion with PostgreSQL (oid)
Hi Armin,
A bit of further digging (sorry to other listers, last couple of emails on
this were sent to Armin only) into the source for the Postgres
JDBC drivers
for version 7.0 reveals the following little snippet:
public void setBinaryStream(int parameterIndex, InputStream x, int
length) throws SQLException
{
throw new PSQLException("postgresql.prep.is");
}
- I guess somebody hasn't gotten around to implemening it yet :-( (that
"postgresql.prep.is" error translates to the "InputStream as parameter not
supported" error you mentioned)
If you really need this to work with postgres I suppose that leaves a few
options:
1) wrap the Postgres drivers and use the Large Objects API behind
the scenes
2) fix the Postgres 7.0 drivers! (I think it's open-source right, and
anybody can dive in and sort stuff out?)
3) Use BMP in Orion and use the (non-portable) Postgres Large Objects API
there
4) downgrade to Postgres 6.5 where I assume this worked (there
are people on
the list using Postgres via JDBC, right?)
5) Wait for this to be fixed (I assume it's fairly high on the
Postgres bug
list)
option 6 is to give up and use another database (which I personally don't
like the sound of having used up a day or so getting postgres
installed and
configured! Depends how long it'll take to work around the
problems though)
cheers
Jules
--
From: Armin Michel[SMTP:[EMAIL PROTECTED]]
Sent: 16 March 2001 09:49
To: Orion-Interest
Subject:Orion with PostgreSQL (oid)
I got some problems with PostgreSQL and Orion when using blobs (oids in
the table).
I checked:
http://www.postgresql.org/users-lounge/docs/7.0/programmer/jdbc6519.htm
In the above page you can read the following example:
snip
To insert an image, you would use:
File file = new File("myimage.gif");
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = conn.prepareStatement("insert into images values
(?,?)");
ps.setString(1,file.getName());
ps.setBinaryStream(2,fis,file.length());
ps.executeUpdate();
ps.close();
fis.close();"
/snip
This does a PreparedStatement.setBinaryStream(int,InputStream,int); -
Exactly what Orion did!
Here is the interesting part of the Exception.printStackTrace(); :
snip
Nested exception is:
InputStream as parameter not supported
at java.lang.Throwable.(Throwable.java:84)
at java.lang.Exception.(Exception.java:35)
at java.sql.SQLException.(SQLException.java:100)
at
org.postgresql.util.PSQLException.(PSQLException.java:22)
at
org.postgresql.jdbc2.PreparedStatement.setBinaryStream(PreparedStatement
.java:417)
at com.evermind.sql.ao.setBinaryStream(JAX)
/snip
So, this would lead to the conclusion, that Orion just tries to use a
standard JDBC-API. Maybe Orion uses a special subclass of InputStream
and
the JDBC-Driver doesn't correctly account for this situation. In the
JDBC
API it reads:
snip
Note: This stream object can either be a standard Java stream object or
your own subclass that implements the standard interface.
/snip
This would blame the JDBC-driver then?
Yours
Armin