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: | 1B3D5E532D18D311861A00600865478CF1B0F1@exchange1.nt.maidstone.gov.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Have you issued:
con.setAutoCommit(false);
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
--
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
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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Mount | 2000-07-19 06:54:38 | RE: Connection.setBytes() |
Previous Message | Peter Mount | 2000-07-19 06:41:50 | RE: jdbc how to get SERIAL |