Thread: Compiling postgres to is jdbc

Compiling postgres to is jdbc

From
MTArgent@silverfe.demon.co.uk (M. T. Argent)
Date:
Hi

I am trying to use the jdbc with postgres, and coming unglued. I'm using
Postgres 7.2 on a netbsd box. At the moment the postgres works fine from
C, so I am truing to recompile in order to use the jdbc.

I've installed ANT, and (as far as I can see) have it working. I've gone
"configure --with-java", and that seems fine, but when I then go "make"
it gets as far as invoking ANT to use the build.xml file, and I then get:

compile:
    [javac] Compiling 1 source file to /home/mark/src/pgsql/src/interfaces/jdbc/build
    [javac] /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:235: ';' expected.
    [javac]             return ${major};
    [javac]                     ^
    [javac] /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:235: Invalid expression statement.
    [javac]             return ${major};
    [javac]                      ^
    [javac] /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:235: ';' expected.
    [javac]             return ${major};
    [javac]                           ^
    [javac] /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:245: ';' expected.
    [javac]              return ${minor};
    [javac]                      ^
    [javac] /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:245: Invalid expression statement.
    [javac]              return ${minor};
    [javac]                       ^
    [javac] /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.java:245: ';' expected.
    [javac]              return ${minor};
    [javac]                            ^
    [javac] 6 errors


These errors appear to relate to code of the following form:

public int getMajorVersion()
{
return ${major};
}


Can anybody shed any light pn what might be going wrong, and what I might be able to do in order to get round it?

Many thanks in advance

mark






Re: Compiling postgres to is jdbc

From
Jason Davies
Date:
On Sun, Jun 09, 2002 at 04:19:58PM +0100, M. T. Argent wrote:
>
> These errors appear to relate to code of the following form:
>
> public int getMajorVersion()
> {
> return ${major};
> }
>

You need to set then ${major} etc. value when generating Driver.java. Do an "ant clean" then try again with something
like,"ant -Dmajor=7 -Dminor=2 -Dblah=...". Check build.xml for the actual property names to set. 

--Jase

Re: Compiling postgres to is jdbc

From
"Joe Shevland"
Date:
You don't actually need to recompile the backend in order for it to
support connections from Java (its just pure TCP/IP); the --with-java
option just compiles the JDBC driver along with the backend. You can also
download the JDBC driver from http://jdbc.postgresql.org .

But, the problem you are seeing is happening as a result of not running
'make' in the top level source directory - you need to do this first
before attempting to build via Ant. IMHO this should not be required as I
don't think the JDBC build process should be dependant on the main
distribution or running make - I think a pure Ant build is more
appropriate for a Java interface.

Cheers,
Joe

> I am trying to use the jdbc with postgres, and coming unglued. I'm using
> Postgres 7.2 on a netbsd box. At the moment the postgres works fine from
> C, so I am truing to recompile in order to use the jdbc.
>
> I've installed ANT, and (as far as I can see) have it working. I've gone
> "configure --with-java", and that seems fine, but when I then go "make"
> it gets as far as invoking ANT to use the build.xml file, and I then
get:
>
> compile:
>     [javac] Compiling 1 source file to
> /home/mark/src/pgsql/src/interfaces/jdbc/build
>     [javac]
> /home/mark/src/pgsql/src/interfaces/jdbc/org/postgresql/Driver.jav
> a:235: ';' expected.
>     [javac]             return ${major};
>     [javac]                     ^
>     [javac]

Attachment

Re: Compiling postgres to is jdbc

From
"Joe Shevland"
Date:
Doh, should've woken up first.

[snip]
> But, the problem you are seeing is happening as a result of not running
> 'make' in the top level source directory - you need to do this first
[snip]
> > I've installed ANT, and (as far as I can see) have it working. I've gone
> > "configure --with-java", and that seems fine, but when I then go "make"

Perhaps a 'make clean' and try it again; I had a similar problem and I think that may fix it.

Cheers,
Joe