Re: JDBC PostgreSQhelL - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: JDBC PostgreSQhelL
Date
Msg-id 3BCF0776.9060307@xythos.com
Whole thread Raw
In response to JDBC PostgreSQhelL  (<acshafer@moon.hec.utah.edu>)
Responses Re: JDBC PostgreSQhelL  (<acshafer@moon.hec.utah.edu>)
List pgsql-jdbc
The problem is that you are using current development code with
instructions that are written for 7.1.

You can either get the 7.1 jdbc drivers which should work according to
the documentation you are using, or you can use the 'compatible'
parameter to set the behavior in the 7.2 driver back to what it was in 7.1.

I haven't yet updated the docs for the changes put in place in the 7.2 code.


thanks,
--Barry



acshafer@moon.hec.utah.edu wrote:

>
> I'm a getting a bit flustered with my old friend Postgresql.  Everything
> was fine and dandy until I decided I needed to use large objects.
>
> At first, after following the documentation, I was getting InputStream not
> supported as a parameter.  I started looking around and found some things
> in the archives that said streams aren't supported until version 7.1. (the
> fact that the documentation gives an example using streams to use large
> objects going at least back to 6.5 is lame, why not just add a note that
> this isn't implemented?  Wouldn't that save the most headaches?) Ok, no
> problem, I'm running 7.0, I can upgrade to 7.1.  After wrestling the RPMs
> into submission, finally got 7.1.3 up and running.  Ok, need new drivers
> now, ok, no problems, add them to the classpath and. . . now I'm getting
> some new funk:
>
> java.sql.SQLException: ERROR:  oidin: error in ". . . a big long string
> representing the file. . . ": can't parse " . . .same big long string,
> again. . ."
>
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:88)
> at org.postgresql.Connection.ExecSQL(Connection.java:356)
> . . .
>
> Here is the gist of the code (should look pretty familiar, it's straight
> out of the documentation):
>
> File file = new File("mytest.blob");
> FileInputStream fis = new FileInputStream(file);
> PreparedStatement ps = con.prepareStatement("insert into blobtest
> values (?,?)");
> ps.setString(1, file.getName());
> ps.setUnicodeStream(2, fis, (int)file.length());
> ps.executeUpdate();
>
>
> Can I get a little direction?  Any idea why I'm getting this error or how
> to make it go away?
>
> I would appreciate if anyone could supply an example or two of working
> code, inserting and recalling files from the db using JDBC.  I would
> prefer to avoid the LargeObjectManager if possible, but if any one would
> care to supply an example of code doing the same thing the
> org.postgresql.largeobject package, I'd like to look through that also.
>
> Also, Is there a javadoc of all the packages in the .jar file for
> postgres?
>
> Sincerely,
>
> Andrew
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>



pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: [PATCHES] Ant configuration
Next
From: root
Date:
Subject: problem with Chinese