From: Matt Fair <matt@netasol.com>
To: pgsql-interfaces@postgresql.org
Subject: Connection.setBytes()
Date: Tue, 18 Jul 2000 13:38:25 -0500
Message-ID: <3974A420.265E7650@netasol.com> (raw)
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
pstmt.executeUpdate();
pstmt.close();
Exception in thread "main" java.lang.NullPointerException
at org.postgresql.Connection.ExecSQL(Connection.java:312)
at org.postgresql.jdbc2.Statement.execute(Statement.java:273)
at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54)
at
org.postgresql.largeobject.LargeObjectManager.<init>(LargeObjectManager.java:106)
at org.postgresql.Connection.getLargeObjectAPI(Connection.java:561)
at
org.postgresql.jdbc2.PreparedStatement.setBytes(PreparedStatement.java:297)
==== >at PsqlConsole.prompt(PsqlConsole.java:65) <====
at PsqlConsole.main(PsqlConsole.java:87)
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
getLargeObjectAPI().
Has anyone else had this error?
Thanks
Matt Fair
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: matt@netasol.com
Subject: Re: Connection.setBytes()
In-Reply-To: <3974A420.265E7650@netasol.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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