Questions about using libpgjava

2003-01-29 Thread Brett Smith
(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



msg02358/pgp0.pgp
Description: PGP signature


Re: Questions about using libpgjava

2003-01-29 Thread Tom Tromey
> "Brett" == Brett Smith <[EMAIL PROTECTED]> writes:

Brett> I know that free PostgreSQL JDBC drivers exist in the libpgjava
Brett> package, and have them installed.  I would like to find out,
Brett> however, whether it's possible to use these drivers with any
Brett> free Java implementations

I believe Anthony Green has used this package with gcj in the past.
I haven't done it myself.

Brett>$ gcj-3.2 basic.java
Brett> returns:
Brett> basic.java: In class `example.basic':
Brett> basic.java: In method `example.basic.doexample()':
Brett> basic.java:91: Class `org.postgresql.PGStatement' not found in type declaration.

This means you have to add the postgresql jar file to your classpath.
See the gcj manual for information on doing that.  Simplest would be
to use a `-I' option, just like with the C compiler.

Brett> Adding a --main=basic to the gcj command line did not appear
Brett> to help much, either:
Brett> /tmp/ccItxrfU.o(.text+0x1d): In function `main':
Brett> /tmp/ccr9ULpD.i: undefined reference to `basic::class$'
Brett> collect2: ld returned 1 exit status

Your class is in package `example'.  You must pass the fully qualified
class name to --main:

gcj --main=example.basic basic.java

(It would be more typical to write `example/basic.java'.  FYI.)

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

gij, like `java' and kaffe, also takes the fully-qualified class name
as its argument.

Tom


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Questions about using libpgjava

2003-01-29 Thread Anthony Green
On Wed, 2003-01-29 at 20:42, Tom Tromey wrote:
> Brett> I know that free PostgreSQL JDBC drivers exist in the libpgjava
> Brett> package, and have them installed.  I would like to find out,
> Brett> however, whether it's possible to use these drivers with any
> Brett> free Java implementations
> 
> I believe Anthony Green has used this package with gcj in the past.
> I haven't done it myself.

That's right - it works very well.  If you're using a recent version of
gcj, you should be able to check the sources out from
http://sources.redhat.com/rhug and simply configure/make/install a
shared library version of this driver.

AG



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Questions about using libpgjava

2003-01-29 Thread Brett Smith
(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


pgpnZ0MfjF0KJ.pgp
Description: PGP signature


Re: Questions about using libpgjava

2003-01-29 Thread Tom Tromey
> "Brett" == Brett Smith <[EMAIL PROTECTED]> writes:

Brett> I know that free PostgreSQL JDBC drivers exist in the libpgjava
Brett> package, and have them installed.  I would like to find out,
Brett> however, whether it's possible to use these drivers with any
Brett> free Java implementations

I believe Anthony Green has used this package with gcj in the past.
I haven't done it myself.

Brett>$ gcj-3.2 basic.java
Brett> returns:
Brett> basic.java: In class `example.basic':
Brett> basic.java: In method `example.basic.doexample()':
Brett> basic.java:91: Class `org.postgresql.PGStatement' not found in type 
declaration.

This means you have to add the postgresql jar file to your classpath.
See the gcj manual for information on doing that.  Simplest would be
to use a `-I' option, just like with the C compiler.

Brett> Adding a --main=basic to the gcj command line did not appear
Brett> to help much, either:
Brett> /tmp/ccItxrfU.o(.text+0x1d): In function `main':
Brett> /tmp/ccr9ULpD.i: undefined reference to `basic::class$'
Brett> collect2: ld returned 1 exit status

Your class is in package `example'.  You must pass the fully qualified
class name to --main:

gcj --main=example.basic basic.java

(It would be more typical to write `example/basic.java'.  FYI.)

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

gij, like `java' and kaffe, also takes the fully-qualified class name
as its argument.

Tom