[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Questions about using libpgjava



(Please CC me on replies; I'm not subscribed.)

Hello,

I should start this e-mail by being as frank as possible: I don't actually
know much of anything about Java.  I've picked up bits of information here
and there, but I haven't had the chance to really start learning the
language yet.  That will change soon.  Unfortunately, however, I must try
to find answers to some specific questions as soon as possible.  As such, I
realize my utter lack of clue may be offensive; if you're willing to bear
with me anyway, I would very much appreciate it.

I'm enrolled in a databases class at the University of Kentucky.  The
original syllabus called for us to implement a programming project using
Java, interfacing with Oracle, on the school's Solaris systems.  Because I
have ethical objections to using proprietary software, I have started to
work out alternative arrangements with the professor.  Currently, we would
like to try to use Java and PostgreSQL on GNU/Linux systems, to be as close
as possible to the original.

I know that free PostgreSQL JDBC drivers exist in the libpgjava package,
and have them installed.  I would like to find out, however, whether it's
possible to use these drivers with any free Java implementations -- most
likely either gcj or kaffe, but if another one works, I'm happy to use it.
I noticed that the package is in contrib, and that the README says that
there's no working free JVM available.  However, the package itself
suggests any of four free Java implementations, so I wasn't sure what to
believe.  If someone could clarify the situation here, it would help
considerably.

In the meantime, I've been trying to compile the examples provided with
libpgjava, but have yet to be successful.  A simple

   $ gcj-3.2 basic.java

returns:

basic.java: In class `example.basic':
basic.java: In method `example.basic.doexample()':
basic.java:91: Class `org.postgresql.PGStatement' not found in type declara=
tion.
                long insertedOID =3D ((org.postgresql.PGStatement)st).getLa=
stOID();
                                        ^
1 error
=20
It looked to me like insertedOID was used only used for debugging, so I
commented out the lines using it, to see if I could make any progress.  I
got a bit farther in compiling it, but not by much:

/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crt1.o(.text+0x18): In function =
`_start':
: undefined reference to `main'
collect2: ld returned 1 exit status

Adding a --main=3Dbasic to the gcj command line did not appear to help much,
either:

/tmp/ccItxrfU.o(.text+0x1d): In function `main':
/tmp/ccr9ULpD.i: undefined reference to `basic::class$'
collect2: ld returned 1 exit status

This exhausted my all-too-small list of things I knew to try.  This was all
with gcj 3.2.2, from the gcj 3.2.2-0pre6 package.

I attempted to run basic.java with Kaffe 1.0.7 (kaffe 1:1.0.7-1) as well,
and got:

java.lang.ClassNotFoundException: basic/java
        at java.lang.Class.forName(Class.java:native)
        at java.lang.Class.forName(Class.java:58)

gij-3.2 reported a similar exception, with a very intricate low-level stack
trace.

If it is, in fact, possible to use PostgreSQL's JDBC drivers with a free
Java implementation, hints on how to go about this would be most helpful.
Thanks in advance,

-- 
-- Brett Smith

Attachment: pgpwzfbAvBlmG.pgp
Description: PGP signature


Reply to: