pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedNullPointerException in blobtest (JDBC)
6+ messages / 5 participants
[nested] [flat]
* NullPointerException in blobtest (JDBC)
@ 1999-06-20 04:11 Ellen Spertus <spertus@ella.mills.edu>
1999-06-20 05:41 ` Re: [INTERFACES] NullPointerException in blobtest (JDBC) Tatsuo Ishii <t-ishii@sra.co.jp>
1999-06-20 15:22 ` Re: [INTERFACES] NullPointerException in blobtest (JDBC) Herouth Maoz <herouth@oumail.openu.ac.il>
0 siblings, 2 replies; 6+ messages in thread
From: Ellen Spertus @ 1999-06-20 04:11 UTC (permalink / raw)
To: pgsql-interfaces; +Cc: spertus@ella.mills.edu
I am getting a NullPointerException when running blobtest. I am using the latest version of everything:
- postgresql 6.5
- jdk 1.2
- jdbc6.5-1.2
- the version of blobtest.java that came with postgresql 6.5
- OS: RH6.0
- x86 (AMD K6)
Here's what happens when I run the program:
[ellen@ellen Work]$ jdb blobtest "jdbc:postgresql://localhost:5432/webdb" ellen foo debug
Initializing jdb...
0xb0:class(blobtest)
> run
run blobtest jdbc:postgresql://localhost:5432/webdb ellen foo debug
PostgreSQL blobtest v6.3 rev 1
running ...
main[1]
DriverManager.initialize: jdbc.drivers = null
JDBC DriverManager initialized
registerDriver: driver[className=postgresql.Driver,postgresql.Driver@3f720c84]
Connecting to Database URL = jdbc:postgresql://localhost:5432/webdb
DriverManager.getConnection("jdbc:postgresql://localhost:5432/webdb")
trying driver[className=postgresql.Driver,postgresql.Driver@3f720c84]
-- listing properties --
password=foo
PGHOST=localhost
user=ellen
PGDBNAME=webdb
Protocol=postgresql
PGPORT=5432
Using postgresql.jdbc2.Connection
getConnection returning driver[className=postgresql.Driver,postgresql.Driver@3f720c84]
Connected...Now creating a statement
----------------------------------------------------------------------
Testing postgresql large object api
Gaining access to large object api
Large Object initialised
Test 1 Creating a large object
Creating a large object
got large object oid=19521
got large object obj=postgresql.largeobject.LargeObject@c2ae0c84
Opening test source object
Copying file to large object
Block size=2048 offset=0
Exception caught.
java.lang.NullPointerException
java.lang.NullPointerException
at java.io.Writer.write(Writer.java:130)
at java.io.PrintStream.write(PrintStream.java:271)
at java.io.PrintStream.print(PrintStream.java:426)
at java.io.PrintStream.println(PrintStream.java:545)
at java.lang.Throwable.printStackTrace(Throwable.java:195)
at java.sql.SQLException.<init>(SQLException.java:103)
at postgresql.util.PSQLException.<init>(PSQLException.java:42)
at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:141)
at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:188)
at postgresql.largeobject.LargeObject.write(LargeObject.java:173)
at postgresql.largeobject.LargeObject.write(LargeObject.java:188)
at blobtest.ownapi_test1(blobtest.java:105)
at blobtest.ownapi(blobtest.java:76)
at blobtest.<init>(blobtest.java:50)
at blobtest.main(blobtest.java:187)
at sun.tools.agent.MainThread.runMain(Native Method)
at sun.tools.agent.MainThread.run(MainThread.java:49)
Current thread "main" died. Execution continuing...
>
blobtest exited
The line that generates the exception (blobtest.java:105) is indicated below:
// copy the data
System.out.println("Copying file to large object");
byte buf[] = new byte[2048];
int s,tl=0;
while((s=fis.read(buf,0,2048))>0) {
System.out.println("Block size="+s+" offset="+tl);
*** obj.write(buf,0,s);
tl+=s;
}
Any ideas?
Ellen
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] NullPointerException in blobtest (JDBC)
1999-06-20 04:11 NullPointerException in blobtest (JDBC) Ellen Spertus <spertus@ella.mills.edu>
@ 1999-06-20 05:41 ` Tatsuo Ishii <t-ishii@sra.co.jp>
1 sibling, 0 replies; 6+ messages in thread
From: Tatsuo Ishii @ 1999-06-20 05:41 UTC (permalink / raw)
To: Ellen Spertus <spertus@ella.mills.edu>; +Cc: pgsql-interfaces
> I am getting a NullPointerException when running blobtest. I am using the latest version of everything:
>
> - postgresql 6.5
> - jdk 1.2
> - jdbc6.5-1.2
> - the version of blobtest.java that came with postgresql 6.5
> - OS: RH6.0
> - x86 (AMD K6)
[snip]
6.5 Large Objects requires each access to LO being inside a
transaction. Try following patches. Peter, can you check them?
---
Tatsuo Ishii
----------------------------------------------------------
inline patch 1: blobtest.java (+3/-0 lines) download inline-1.patch
*** blobtest.java~ Tue Jan 13 11:19:16 1998
--- blobtest.java Sun Jun 20 14:10:59 1999
***************
*** 40,45 ****
--- 40,46 ----
// Connect to database
System.out.println("Connecting to Database URL = " + url);
db = DriverManager.getConnection(url, usr, pwd);
+ db.setAutoCommit(false);
System.out.println("Connected...Now creating a statement");
s = db.createStatement();
***************
*** 52,57 ****
--- 53,60 ----
// Now run tests using JDBC methods
//jdbcapi(db,s);
+ s.executeUpdate("commit");
+
// Finally close the database
System.out.println("Now closing the connection");
s.close();
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] NullPointerException in blobtest (JDBC)
1999-06-20 04:11 NullPointerException in blobtest (JDBC) Ellen Spertus <spertus@ella.mills.edu>
@ 1999-06-20 15:22 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-06-20 22:10 ` Re: [INTERFACES] NullPointerException in blobtest (JDBC) Tatsuo Ishii <t-ishii@sra.co.jp>
1 sibling, 1 reply; 6+ messages in thread
From: Herouth Maoz @ 1999-06-20 15:22 UTC (permalink / raw)
To: t-ishii@sra.co.jp; +Cc: pgsql-interfaces
At 08:41 +0300 on 20/06/1999, Tatsuo Ishii wrote:
> + s.executeUpdate("commit");
> +
Shouldn't this be db.commit() instead?
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] NullPointerException in blobtest (JDBC)
1999-06-20 04:11 NullPointerException in blobtest (JDBC) Ellen Spertus <spertus@ella.mills.edu>
1999-06-20 15:22 ` Re: [INTERFACES] NullPointerException in blobtest (JDBC) Herouth Maoz <herouth@oumail.openu.ac.il>
@ 1999-06-20 22:10 ` Tatsuo Ishii <t-ishii@sra.co.jp>
0 siblings, 0 replies; 6+ messages in thread
From: Tatsuo Ishii @ 1999-06-20 22:10 UTC (permalink / raw)
To: Herouth Maoz <herouth@oumail.openu.ac.il>; +Cc: t-ishii@sra.co.jp; pgsql-interfaces
>> + s.executeUpdate("commit");
>> +
>
>Shouldn't this be db.commit() instead?
Thanks for the correction!
--
Tatsuo Ishii
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] NullPointerException in blobtest (JDBC)
@ 1999-06-20 23:52 spertus@ella.mills.edu
0 siblings, 0 replies; 6+ messages in thread
From: spertus@ella.mills.edu @ 1999-06-20 23:52 UTC (permalink / raw)
To: t-ishii@sra.co.jp; +Cc: pgsql-interfaces; herouth@oumail.openu.ac.il
Your suggestions worked. Thank you so much.
Ellen Spertus
^ permalink raw reply [nested|flat] 6+ messages in thread
* RE: [INTERFACES] NullPointerException in blobtest (JDBC)
@ 1999-06-21 07:54 Peter Mount <petermount@it.maidstone.gov.uk>
0 siblings, 0 replies; 6+ messages in thread
From: Peter Mount @ 1999-06-21 07:54 UTC (permalink / raw)
To: 't-ishii@sra.co.jp' <t-ishii@sra.co.jp>; Ellen Spertus <spertus@ella.mills.edu>; +Cc: pgsql-interfaces
Looks ok, except you should use db.commit() (which Heroth has already
stated) ;-)
Peter
--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.
-----Original Message-----
From: Tatsuo Ishii [mailto:t-ishii@sra.co.jp]
Sent: Sunday, June 20, 1999 6:42 AM
To: Ellen Spertus
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] NullPointerException in blobtest (JDBC)
> I am getting a NullPointerException when running blobtest. I am using
the latest version of everything:
>
> - postgresql 6.5
> - jdk 1.2
> - jdbc6.5-1.2
> - the version of blobtest.java that came with postgresql 6.5
> - OS: RH6.0
> - x86 (AMD K6)
[snip]
6.5 Large Objects requires each access to LO being inside a
transaction. Try following patches. Peter, can you check them?
---
Tatsuo Ishii
----------------------------------------------------------
inline patch 1: blobtest.java (+3/-0 lines) download inline-1.patch
*** blobtest.java~ Tue Jan 13 11:19:16 1998
--- blobtest.java Sun Jun 20 14:10:59 1999
***************
*** 40,45 ****
--- 40,46 ----
// Connect to database
System.out.println("Connecting to Database URL = " + url);
db = DriverManager.getConnection(url, usr, pwd);
+ db.setAutoCommit(false);
System.out.println("Connected...Now creating a statement");
s = db.createStatement();
***************
*** 52,57 ****
--- 53,60 ----
// Now run tests using JDBC methods
//jdbcapi(db,s);
+ s.executeUpdate("commit");
+
// Finally close the database
System.out.println("Now closing the connection");
s.close();
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~1999-06-21 07:54 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-06-20 04:11 NullPointerException in blobtest (JDBC) Ellen Spertus <spertus@ella.mills.edu>
1999-06-20 05:41 ` Tatsuo Ishii <t-ishii@sra.co.jp>
1999-06-20 15:22 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-06-20 22:10 ` Tatsuo Ishii <t-ishii@sra.co.jp>
1999-06-20 23:52 Re: [INTERFACES] NullPointerException in blobtest (JDBC) spertus@ella.mills.edu
1999-06-21 07:54 RE: [INTERFACES] NullPointerException in blobtest (JDBC) Peter Mount <petermount@it.maidstone.gov.uk>
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