Thread: Pb. when compiling jdbc (postgresql-6.4.2)

Pb. when compiling jdbc (postgresql-6.4.2)

From
"Loic Mahe'"
Date:
Hello,

I've recently downloaded and compiled postgresql-6.4.2.
I'm working on a FreeBSD 3.1.
For the compilation of postgresql-6.4.2 itself, everything worked well,
but things were more tricky with jdbc. Nevertheless, I finally
managed to compile it.

There are (IMHO) some erros in the jdbc Makefile
(in src/interfaces/jdbc) :
- the following line was after ".java.class:", but it should be before
  (or the Makefile will not work) :
.SUFFIXES:    .class .java
- there is a missing line :
postgresql/geometric/PGline.class :   postgresql/geometric/PGline.java

While preparing the doc ("make doc"), several error messages came out,
like this one :
> Method void SendPacket(byte[])
> documents that it throws class java.sql.SQLException,
> but does not declare it
Any idea about that ?

Last thing ; why is the following line commented out ?
#example/Objects.class:                       example/Objects.java

Below, you will find the modified Makefile I used.

Bye !

Loic - Toulouse/France

PS : I'm not on the pgsql-interfaces mailing list, if you want to reply
------------------------------------------------------------------------
#-------------------------------------------------------------------------
#
# Makefile
#    Makefile for Java JDBC interface
#
# IDENTIFICATION
#    $Header: /usr/local/cvsroot/pgsql/src/interfaces/jdbc/Makefile,v
1.10 1998/10/08 00:38:18 momjian Exp $
#
#-------------------------------------------------------------------------

# These are commented out, but would be included in the postgresql
source

FIND        = find
JAR        = jar
JAVA        = java
JAVAC        = javac
JAVADOC        = javadoc
RM        = rm -f

.SUFFIXES:    .class .java

# This defines how to compile a java class
.java.class:
    $(JAVAC) $<

.PHONY:        all clean doc examples

all:      postgresql.jar
    @echo ------------------------------------------------------------
    @echo The JDBC driver has now been built. To make it available to
    @echo other applications, copy the postgresql.jar file to a public
    @echo "place (under unix this could be /usr/local/lib) and add it"
    @echo to the class path.
    @echo
    @echo Then either add -Djdbc.drivers=postgresql.Driver to the
    @echo commandline when running your application, or edit the
    @echo "properties file for your application (~/.hotjava/properties"
    @echo "under unix for HotJava), and add a line containing"
    @echo jdbc.drivers=postgresql.Driver
    @echo
    @echo More details are in the README file.
    @echo ------------------------------------------------------------
    @echo To build the examples, type:
    @echo "  make examples"
    @echo ------------------------------------------------------------
    @echo

dep depend:

# This rule builds the javadoc documentation
doc:
    export CLASSPATH=.;\
        $(JAVADOC) -public \
            postgresql \
            postgresql.fastpath \
            postgresql.largeobject

# These classes form the driver. These, and only these are placed into
# the jar file.
OBJS=    postgresql/CallableStatement.class \
    postgresql/Connection.class \
    postgresql/DatabaseMetaData.class \
    postgresql/Driver.class \
    postgresql/Field.class \
    postgresql/PG_Stream.class \
    postgresql/PreparedStatement.class \
    postgresql/ResultSet.class \
    postgresql/ResultSetMetaData.class \
    postgresql/Statement.class \
    postgresql/fastpath/Fastpath.class \
    postgresql/fastpath/FastpathArg.class \
    postgresql/geometric/PGbox.class \
    postgresql/geometric/PGcircle.class \
    postgresql/geometric/PGline.class \
    postgresql/geometric/PGlseg.class \
    postgresql/geometric/PGpath.class \
    postgresql/geometric/PGpoint.class \
    postgresql/geometric/PGpolygon.class \
    postgresql/largeobject/LargeObject.class \
    postgresql/largeobject/LargeObjectManager.class \
    postgresql/util/PGmoney.class \
    postgresql/util/PGobject.class \
    postgresql/util/PGtokenizer.class \
    postgresql/util/Serialize.class \
    postgresql/util/UnixCrypt.class

# If you have problems with the first line, try the second one.
# This is needed when compiling under Solaris, as the solaris sh doesn't
# recognise $( )
postgresql.jar: $(OBJS)
#    $(JAR) -c0f $@ $$($(FIND) postgresql -name "*.class" -print)
    $(JAR) -c0f $@ `$(FIND) postgresql -name "*.class" -print`

# This rule removes any temporary and compiled files from the source
tree.
clean:
    $(FIND) . -name "*~" -exec $(RM) {} \;
    $(FIND) . -name "*.class" -exec $(RM) {} \;
    $(FIND) . -name "*.html" -exec $(RM) {} \;
    $(RM) postgresql.jar
    -$(RM) -rf Package-postgresql *output

#######################################################################
# This helps make workout what classes are from what source files
#
# Java is unlike C in that one source file can generate several
# _Different_ file names
#
postgresql/CallableStatement.class:    postgresql/CallableStatement.java
postgresql/Connection.class:        postgresql/Connection.java
postgresql/DatabaseMetaData.class:    postgresql/DatabaseMetaData.java
postgresql/Driver.class:        postgresql/Driver.java
postgresql/Field.class:            postgresql/Field.java
postgresql/PG_Stream.class:        postgresql/PG_Stream.java
postgresql/PreparedStatement.class:    postgresql/PreparedStatement.java
postgresql/ResultSet.class:        postgresql/ResultSet.java
postgresql/ResultSetMetaData.class:    postgresql/ResultSetMetaData.java
postgresql/Statement.class:        postgresql/Statement.java
postgresql/fastpath/Fastpath.class:    postgresql/fastpath/Fastpath.java
postgresql/fastpath/FastpathArg.class:
postgresql/fastpath/FastpathArg.java
postgresql/geometric/PGbox.class:    postgresql/geometric/PGbox.java
postgresql/geometric/PGcircle.class:    postgresql/geometric/PGcircle.java
postgresql/geometric/PGline.class :    postgresql/geometric/PGline.java
postgresql/geometric/PGlseg.class:    postgresql/geometric/PGlseg.java
postgresql/geometric/PGpath.class:    postgresql/geometric/PGpath.java
postgresql/geometric/PGpoint.class:    postgresql/geometric/PGpoint.java
postgresql/geometric/PGpolygon.class:
postgresql/geometric/PGpolygon.java
postgresql/largeobject/LargeObject.class:
postgresql/largeobject/LargeObject.java
postgresql/largeobject/LargeObjectManager.class:
postgresql/largeobject/LargeObjectManager.java
postgresql/util/PGmoney.class:        postgresql/util/PGmoney.java
postgresql/util/PGobject.class:        postgresql/util/PGobject.java
postgresql/util/PGtokenizer.class:    postgresql/util/PGtokenizer.java
postgresql/util/Serialize.class:    postgresql/util/Serialize.java
postgresql/util/UnixCrypt.class:    postgresql/util/UnixCrypt.java

#######################################################################
# These classes are in the example directory, and form the examples
EX=    example/basic.class \
    example/blobtest.class \
    example/datestyle.class \
    example/psql.class \
    example/ImageViewer.class \
    example/metadata.class \
    example/threadsafe.class
#    example/Objects.class

# This rule builds the examples
examples:    postgresql.jar $(EX)
    @echo ------------------------------------------------------------
    @echo The examples have been built.
    @echo
    @echo For instructions on how to use them, simply run them. For
example:
    @echo
    @echo "  java example.blobtest"
    @echo
    @echo This would display instructions on how to run the example.
    @echo ------------------------------------------------------------
    @echo Available examples:
    @echo
    @echo "  example.basic        Basic JDBC useage"
    @echo "  example.blobtest     Binary Large Object tests"
    @echo "  example.datestyle    Shows how datestyles are handled"
    @echo "  example.ImageViewer  Example application storing images"
    @echo "  example.psql         Simple java implementation of psql"
    @echo "  example.Objects      Demonstrates Object Serialisation"
    @echo " "
    @echo These are not really examples, but tests various parts of the
driver
    @echo "  example.metadata     Tests various metadata methods"
    @echo "  example.threadsafe   Tests the driver's thread safety"
    @echo ------------------------------------------------------------
    @echo

example/basic.class:            example/basic.java
example/blobtest.class:            example/blobtest.java
example/datestyle.class:        example/datestyle.java
example/psql.class:            example/psql.java
example/ImageViewer.class:        example/ImageViewer.java
example/Objects.class:            example/Objects.java
example/threadsafe.class:        example/threadsafe.java
example/metadata.class:            example/metadata.java
#######################################################################