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

RE: Connection.setBytes()

From: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
To: "'Matt Fair'" <matt(at)netasol(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: RE: Connection.setBytes()
Date: 2000-07-19 06:47:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Have you issued:


Before the first call to setBytes()?

In theory, you should get a different exception thrown but it's the first
thing to check with BLOBS.

The second, can you turn on debugging
(DriverManager.setLogStream(System.err);) to see the query failing. This is
the second report today of an internal query failing, and I'm now wondering
if something in the system tables have changed that's causing these errors -
although I should have seen it when I ran the tests on 7.0 (although it may
have occured in 7.0.1 or 7.0.2).


Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council

-----Original Message-----
From: Matt Fair [mailto:matt(at)netasol(dot)com]
Sent: Tuesday, July 18, 2000 7:38 PM
To: pgsql-interfaces(at)postgresql(dot)org
Subject: [INTERFACES] Connection.setBytes()

I want to set an array of bytes to a prepared statement, but it throws a
null pointer exception.  Here is my code:

        String description = new String(".........4000 Bytes.......");
        PreparedStatement pstmt = con.prepareStatement("INSERT INTO
mytable (str) VALUES (?)");
        pstmt.setBytes(1,description.getBytes());  //Line 65, throws
NullPointerException here

Exception in thread "main" java.lang.NullPointerException
 at org.postgresql.Connection.ExecSQL(
 at org.postgresql.jdbc2.Statement.execute(
 at org.postgresql.jdbc2.Statement.executeQuery(

 at org.postgresql.Connection.getLargeObjectAPI(

 ==== >at PsqlConsole.prompt( <====
 at PsqlConsole.main(

It throws it when I call setBytes(), I don't know what the problem is.
I got the source of setBytes and put it in my code where I have
setBytes().  It was throwing a null pointer when it was calling
Has anyone else had this error?
Matt Fair

pgsql-interfaces by date

Next:From: Peter MountDate: 2000-07-19 06:54:38
Subject: RE: Connection.setBytes()
Previous:From: Peter MountDate: 2000-07-19 06:41:50
Subject: RE: jdbc how to get SERIAL

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