Error in Programmer's Guide: JDBC

Started by Jeff Duffyover 25 years ago4 messagesdocs
Jump to latest
#1Jeff Duffy
jduffy@greatbridge.com

Greetings,

In the release version of the Programmer's Guide, the chapter on JDBC
(I used the one at
http://www.postgresql.org/users-lounge/docs/7.0/programmer/jdbc6424.htm
)
has an example of using the class loader to load the Postgres JDBC
driver that uses the incorrect driver class name:

Class.forName("postgresql.Driver");

This same error is repeated in the example for loading the driver using
the command line switch:

% java -Djdbc.drivers=postgresql.Driver example.ImageViewer

The correct driver class (at least in the latest release with the filename
jdbc7.0-1.2.jar, obtained from Peter Mount's site at
http://www.retep.org.uk/postgres/download.html) should be
org.postgresql.Driver, thus changing the docs to read

Class.forName("org.postgresql.Driver");

and

% java -Djdbc.drivers=org.postgresql.Driver example.ImageViewer

Following the docs will cause the code to throw an exception with the
message "java.lang.NoClassDefFoundError: postgresql.Driver".

In the future, should we submit SGML diffs?

Jeff

#2Bruce Momjian
bruce@momjian.us
In reply to: Jeff Duffy (#1)
Re: Error in Programmer's Guide: JDBC

You should see the current development docs have this fixed. Sorry we
didn't go back and fix 7.0 docs.

Greetings,

In the release version of the Programmer's Guide, the chapter on JDBC
(I used the one at
http://www.postgresql.org/users-lounge/docs/7.0/programmer/jdbc6424.htm
)
has an example of using the class loader to load the Postgres JDBC
driver that uses the incorrect driver class name:

Class.forName("postgresql.Driver");

This same error is repeated in the example for loading the driver using
the command line switch:

% java -Djdbc.drivers=postgresql.Driver example.ImageViewer

The correct driver class (at least in the latest release with the filename
jdbc7.0-1.2.jar, obtained from Peter Mount's site at
http://www.retep.org.uk/postgres/download.html) should be
org.postgresql.Driver, thus changing the docs to read

Class.forName("org.postgresql.Driver");

and

% java -Djdbc.drivers=org.postgresql.Driver example.ImageViewer

Following the docs will cause the code to throw an exception with the
message "java.lang.NoClassDefFoundError: postgresql.Driver".

In the future, should we submit SGML diffs?

Jeff

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Peter T Mount
peter@retep.org.uk
In reply to: Jeff Duffy (#1)
Re: Error in Programmer's Guide: JDBC

Quoting Jeff Duffy <jduffy@greatbridge.com>:

Greetings,

In the release version of the Programmer's Guide, the chapter on JDBC
(I used the one at
http://www.postgresql.org/users-lounge/docs/7.0/programmer/jdbc6424.htm
)
has an example of using the class loader to load the Postgres JDBC
driver that uses the incorrect driver class name:

Class.forName("postgresql.Driver");

This same error is repeated in the example for loading the driver
using
the command line switch:

% java -Djdbc.drivers=postgresql.Driver example.ImageViewer

The correct driver class (at least in the latest release with the
filename
jdbc7.0-1.2.jar, obtained from Peter Mount's site at
http://www.retep.org.uk/postgres/download.html) should be
org.postgresql.Driver, thus changing the docs to read

Class.forName("org.postgresql.Driver");

and

% java -Djdbc.drivers=org.postgresql.Driver example.ImageViewer

Following the docs will cause the code to throw an exception with the
message "java.lang.NoClassDefFoundError: postgresql.Driver".

I'll fix that one shortly (doing another commit this morning anyhow).

In the future, should we submit SGML diffs?

For the docs that might be an idea.

PS: After 7.1, I'm thinking of rewriting the docs as the current jdbc docs are
not that accurate to 7.1. Anyhow my main priority is to get the driver working
for 7.1.

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

#4Peter T Mount
peter@retep.org.uk
In reply to: Jeff Duffy (#1)
Re: Error in Programmer's Guide: JDBC

Hmmm, it seems this has already been done (at least before the begining of last
week).

Peter

Quoting Jeff Duffy <jduffy@greatbridge.com>:

Greetings,

In the release version of the Programmer's Guide, the chapter on JDBC
(I used the one at
http://www.postgresql.org/users-lounge/docs/7.0/programmer/jdbc6424.htm
)
has an example of using the class loader to load the Postgres JDBC
driver that uses the incorrect driver class name:

Class.forName("postgresql.Driver");

This same error is repeated in the example for loading the driver
using
the command line switch:

% java -Djdbc.drivers=postgresql.Driver example.ImageViewer

The correct driver class (at least in the latest release with the
filename
jdbc7.0-1.2.jar, obtained from Peter Mount's site at
http://www.retep.org.uk/postgres/download.html) should be
org.postgresql.Driver, thus changing the docs to read

Class.forName("org.postgresql.Driver");

and

% java -Djdbc.drivers=org.postgresql.Driver example.ImageViewer

Following the docs will cause the code to throw an exception with the
message "java.lang.NoClassDefFoundError: postgresql.Driver".

In the future, should we submit SGML diffs?

Jeff

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/