Thread: Is DataSource implemented?

Is DataSource implemented?

From
Larry Mulcahy
Date:
Referring back to
http://fts.postgresql.org/db/mw/msg.html?mid=82946,
I tried to use [org.]postgresql.PostgresqlDataSource
but could not find it in
/usr/local/pgsql/share/java/postgresql.jar, created
today by compiling PostgreSQL 7.1.1 from the sources.

When I list postgresql.jar with
jar tvf /usr/local/pgsql/share/java/postgresql.jar,
it has the other classes that are supposed to be
under org.postgresql:

 12171 Tue May 08 15:48:50 MDT 2001 org/postgresql/Connection.class
  4332 Tue May 08 15:48:50 MDT 2001 org/postgresql/PG_Stream.class
  4204 Tue May 08 15:48:50 MDT 2001 org/postgresql/Driver.class
  2836 Tue May 08 15:48:50 MDT 2001 org/postgresql/Field.class
  2440 Tue May 08 15:48:50 MDT 2001 org/postgresql/ResultSet.class
   347 Tue May 08 15:48:52 MDT 2001 org/postgresql/Statement.class

but not PostgresqlDataSource.

I can see PostgresqlDataSource.java
sitting there in src/interfaces/jdbc/org/postgresql,
but it's not being compiled and finding its way into the
.jar file.

I see in postgresql-7.1.1/src/interfaces/jdbc/Implementation
this provocative hint:

PostgresqlDataSource
                Exists in the Java2 Enterprise edition driver only and
is the
                enterprise equivalent to Driver

What do I need to do to get the DataSource class?  Build
with some J2EE stuff?

--
        Larry Mulcahy        lmulcahy@qip.qwest.net
              PGP public key at:
   http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03

Re: Is DataSource implemented?

From
Larry Mulcahy
Date:
Never mind, I figured it out.

Ant's build.xml (src/interfaces/jdbc/build.xml) decides whether
to build the 'enterprise' version of postgresql.jar by
checking whether the class javax.sql.DataSource is present.

The solution is to install the J2EE SDK, then make sure
j2ee.jar is in the classpath when ant builds the JDBC driver.

Example, my build script for all of PostgreSQL is now:

#!/bin/sh

CLASSPATH=/usr/local/java/j2sdkee1.2.1/lib/j2ee.jar
export CLASSPATH

make distclean
CC=gcc CXX=g++ CFLAGS=-O2 CXXFLAGS=-O2 \
./configure \
    --with-java \
    --enable-odbc \
    --enable-syslog
make -j 2
make check

Larry Mulcahy wrote:
>
> Referring back to
> http://fts.postgresql.org/db/mw/msg.html?mid=82946,
> I tried to use [org.]postgresql.PostgresqlDataSource
> but could not find it in
> /usr/local/pgsql/share/java/postgresql.jar, created
> today by compiling PostgreSQL 7.1.1 from the sources.
>
> When I list postgresql.jar with
> jar tvf /usr/local/pgsql/share/java/postgresql.jar,
> it has the other classes that are supposed to be
> under org.postgresql:
>
>  12171 Tue May 08 15:48:50 MDT 2001 org/postgresql/Connection.class
>   4332 Tue May 08 15:48:50 MDT 2001 org/postgresql/PG_Stream.class
>   4204 Tue May 08 15:48:50 MDT 2001 org/postgresql/Driver.class
>   2836 Tue May 08 15:48:50 MDT 2001 org/postgresql/Field.class
>   2440 Tue May 08 15:48:50 MDT 2001 org/postgresql/ResultSet.class
>    347 Tue May 08 15:48:52 MDT 2001 org/postgresql/Statement.class
>
> but not PostgresqlDataSource.
>
> I can see PostgresqlDataSource.java
> sitting there in src/interfaces/jdbc/org/postgresql,
> but it's not being compiled and finding its way into the
> .jar file.
>
> I see in postgresql-7.1.1/src/interfaces/jdbc/Implementation
> this provocative hint:
>
> PostgresqlDataSource
>                 Exists in the Java2 Enterprise edition driver only and
> is the
>                 enterprise equivalent to Driver
>
> What do I need to do to get the DataSource class?  Build
> with some J2EE stuff?

--
        Larry Mulcahy        lmulcahy@qip.qwest.net
              PGP public key at:
   http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03

Re: Is DataSource implemented?

From
Peter Mount
Date:
At 09:57 09/05/01 -0600, Larry Mulcahy wrote:
>Never mind, I figured it out.
>
>Ant's build.xml (src/interfaces/jdbc/build.xml) decides whether
>to build the 'enterprise' version of postgresql.jar by
>checking whether the class javax.sql.DataSource is present.
>
>The solution is to install the J2EE SDK, then make sure
>j2ee.jar is in the classpath when ant builds the JDBC driver.

Correct. J2EE is only an extension to J2SE.

Peter