RE: Connection.setBytes()

Поиск
Список
Период
Сортировка
От Peter Mount
Тема RE: Connection.setBytes()
Дата
Msg-id 1B3D5E532D18D311861A00600865478CF1B0F1@exchange1.nt.maidstone.gov.uk
обсуждение исходный текст
Ответ на Connection.setBytes()  (Matt Fair <matt@netasol.com>)
Список 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@netasol.com]
Sent: Tuesday, July 18, 2000 7:38 PM
To: pgsql-interfaces@postgresql.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("INSERTINTO
 
mytable (str) VALUES (?)");       pstmt.setBytes(1,description.getBytes());  //Line 65, throws
NullPointerException here       pstmt.executeUpdate();       pstmt.close();

Exception in thread "main" java.lang.NullPointerExceptionat 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


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Peter Mount
Дата:
Сообщение: RE: jdbc how to get SERIAL
Следующее
От: Peter Mount
Дата:
Сообщение: RE: Connection.setBytes()