pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ellen Spertus <spertus@ella.mills.edu>
To: pgsql-interfaces@postgresql.org
Cc: spertus@ella.mills.edu
Subject: Problem with JDBC and blobtest
Date: 19 Jun 1999 19:59:16 -0700
Message-ID: <19990620025916.94089.qmail@ella.mills.edu> (raw)

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





Message-ID: <19990620025916.94089.qmail@ella.mills.edu>
Permalink:  ../19990620025916.94089.qmail@ella.mills.edu/
Also on:    postgresql.org/message-id/19990620025916.94089.qmail@ella.mills.edu

 · 

reply

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: spertus@ella.mills.edu
  Subject: Re: Problem with JDBC and blobtest
  In-Reply-To: <19990620025916.94089.qmail@ella.mills.edu>

* 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