Skip site navigation (1) Skip section navigation (2)

Re: blob setBinaryStream

From: Matt Fair <matt(at)netasol(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: blob setBinaryStream
Date: 2001-09-24 14:58:09
Message-ID: 3BAF4A01.9080407@netasol.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
The stack trace I get with this is:
   
Parameter index out of range.
        at 
org.postgresql.jdbc2.PreparedStatement.set(PreparedStatement.java:658)
        at 
org.postgresql.jdbc2.PreparedStatement.setInt(PreparedStatement.java:210)
        at 
org.opensimpx.server.RequestHandler.storeBackgroundImage(RequestHandler.java:628)
        at 
org.opensimpx.server.RequestHandler.recieve(RequestHandler.java:597)
        at org.opensimpx.server.RequestHandler.run(RequestHandler.java:215)
        at java.lang.Thread.run(Thread.java:479)
Any help with this would be greatly appreciated.
Thanks in advanced.
Matt

Matt Fair wrote:

> Do you need to create a transaction to set blobs?
>        con.setAutoCommit(false);
>        FileInputStream fis = new FileInputStream(file);
>        PreparedStatement ps = con.prepareStatement("update= 
> userpreferences set image='?' and time=? where user='?'");
>        Logger.log("Setting Binary Stream");
>        ps.setBinaryStream(1, fis, length);
>        ps.setInt(2, (int)new java.util.Date().getTime());
>        ps.setString(3, user);
>        ps.executeUpdate();
>        ps.close();
>        fis.close();
>        con.commit();
>        con.setAutoCommit(true) ;
>
> When Set Binarystream calls the setInt method, it throws a 
> SQLExceptionParameter index out of range.
> Does anyone know what this could be?
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>




In response to

pgsql-jdbc by date

Next:From: Rene PijlmanDate: 2001-09-24 15:21:23
Subject: Re: blob setBinaryStream
Previous:From: Matt FairDate: 2001-09-24 14:46:49
Subject: blob setBinaryStream

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group