pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7577: JDBC Driver - Compiled with Java 7
5+ messages / 4 participants
[nested] [flat]

* BUG #7577: JDBC Driver - Compiled with Java 7
@ 2012-10-02 04:55  nicwillemse@gmail.com
  0 siblings, 1 reply; 5+ messages in thread

From: nicwillemse@gmail.com @ 2012-10-02 04:55 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7577
Logged by:          Nic Willemse
Email address:      nicwillemse@gmail.com
PostgreSQL version: 9.1.0
Operating system:   Linux
Description:        

Hi, 

I downloaded the JDBC driver located at
http://jdbc.postgresql.org/index.html

I specifically requested the JDBC3 version as Im running Java version 6.

I found that it was compiled using Java 7.

I believe that this should be fixed as JDBC3 is supported by java 5 & 6 and
it would make more sense to have it compiled to this version.

Regards,
Nic







^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #7577: JDBC Driver - Compiled with Java 7
@ 2012-10-15 15:10  seancompusult <sean@compusult.net>
  parent: nicwillemse@gmail.com
  0 siblings, 1 reply; 5+ messages in thread

From: seancompusult @ 2012-10-15 15:10 UTC (permalink / raw)
  To: pgsql-bugs

To add to this, it's not just a question of making more sense.  Compiling the
code with Java 7 means the generated class files are version 51, which is
not acceptable to a Java 5 JRE - it wants version 49.  So the existing
pre-built jar cannot simply be dropped into a Java 5 app.

To get around this I'm trying to build from source without much more
success.  When I follow the recommendation of using a 1.5 JDK, for some
reason ant still craps out with an UnsupportedClassVersionError.  I also
tried to hack the build.xml to force compilation with source="1.5" and
target="1.5", but then the compilation fails like this:

compile:
    [javac] /opt/sean/software/postgresql-jdbc-9.0-802.src/build.xml:120:
warning: 'includeantruntime' was not set, defaulting to
build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 176 source files to
/opt/sean/software/postgresql-jdbc-9.0-802.src/build
    [javac] warning: [options] bootstrap class path not set in conjunction
with -source 1.5
    [javac]
/opt/sean/software/postgresql-jdbc-9.0-802.src/org/postgresql/Driver.java:47:
error: org.postgresql.Driver is not abstract and does not override abstract
method getParentLogger() in java.sql.Driver
    [javac] public class Driver implements java.sql.Driver
    [javac]        ^
    [javac]
/opt/sean/software/postgresql-jdbc-9.0-802.src/org/postgresql/ds/PGConnectionPoolDataSource.java:39:
error: PGConnectionPoolDataSource is not abstract and does not override
abstract method getParentLogger() in CommonDataSource
    [javac] public class PGConnectionPoolDataSource extends BaseDataSource
implements Serializable, ConnectionPoolDataSource
    [javac]        ^
    [javac]
/opt/sean/software/postgresql-jdbc-9.0-802.src/org/postgresql/ds/PGPooledConnection.java:26:
error: PGPooledConnection is not abstract and does not override abstract
method removeStatementEventListener(StatementEventListener) in
PooledConnection

etc.

Does anyone have a solution for people like me who must use Java 5?

Thanks,
Sean



--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-7577-JDBC-Driver-Compiled-with-Java-7-tp5726254p5728220....
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #7577: JDBC Driver - Compiled with Java 7
@ 2012-10-16 02:38  Craig Ringer <ringerc@ringerc.id.au>
  parent: seancompusult <sean@compusult.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Craig Ringer @ 2012-10-16 02:38 UTC (permalink / raw)
  To: seancompusult <sean@compusult.net>; +Cc: pgsql-bugs

On 10/15/2012 11:10 PM, seancompusult wrote:
> Does anyone have a solution for people like me who must use Java 5?

I had no problems building current git head of the JDBC driver with Java 
SE 5, nor the REL_9_2_STABLE branch.


export PATH=$HOME/java/jdk1.5.0_22/bin:$HOME/java/jdk1.5.0_22/jre/bin:$PATH;

export JAVA_HOME=$HOME/java/jdk1.5.0_22/

ant clean jar

--
Craig Ringer





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [Spam] Re: BUG #7577: JDBC Driver - Compiled with Java 7
@ 2012-10-16 12:10  Sean Hogan <sean@compusult.net>
  parent: Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 1 reply; 5+ messages in thread

From: Sean Hogan @ 2012-10-16 12:10 UTC (permalink / raw)
  To: Craig Ringer <ringerc@ringerc.id.au>; +Cc: pgsql-bugs

On 12-10-16 12:08 AM, Craig Ringer wrote:
> On 10/15/2012 11:10 PM, seancompusult wrote:
>> Does anyone have a solution for people like me who must use Java 5?
>
> I had no problems building current git head of the JDBC driver with 
> Java SE 5, nor the REL_9_2_STABLE branch.
>

Ah, quite right.  I was having a problem running ant, because it itself 
was compiled with Java 7.  :-(  IMO the whole approach of relying on 
compiling with specific Java versions is flawed, but at least I've 
gotten past this issue so I'm happy.  Thanks for that.

Sean

Attachments:

sean.vcf (text/x-vcard, 273B) download begin:vcard fn:Sean Hogan n:Hogan;Sean org:Compusult Ltd. adr:;;40 Bannister St.;Mount Pearl;NL;A1N 3C9;Canada email;internet:sean@compusult.net title:Project Engineer tel;work:+1 709 745-7914 x249 tel;fax:+1 709 745-7927 url:http://www.compusult.net/ version:2.1 end:vcard
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: [Spam] Re: BUG #7577: JDBC Driver - Compiled with Java 7
@ 2012-10-16 12:24  Craig Ringer <ringerc@ringerc.id.au>
  parent: Sean Hogan <sean@compusult.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Craig Ringer @ 2012-10-16 12:24 UTC (permalink / raw)
  To: Sean Hogan <sean@compusult.net>; +Cc: pgsql-bugs

On 10/16/2012 08:10 PM, Sean Hogan wrote:
> On 12-10-16 12:08 AM, Craig Ringer wrote:
>> On 10/15/2012 11:10 PM, seancompusult wrote:
>>> Does anyone have a solution for people like me who must use Java 5?
>>
>> I had no problems building current git head of the JDBC driver with
>> Java SE 5, nor the REL_9_2_STABLE branch.
>>
>
> Ah, quite right.  I was having a problem running ant, because it itself
> was compiled with Java 7.  :-(  IMO the whole approach of relying on
> compiling with specific Java versions is flawed, but at least I've
> gotten past this issue so I'm happy.  Thanks for that.

Yes, it's flawed, but it's also unfortunately necessary.

javac offers flags like -source 1.5 -target 1.5 for controlling bytecode 
generation and source compatibility. That's fine, but it offers 
absolutely no way to say "treat standard library packages, classes and 
methods added after Java SE 5 as missing".

This means that for testing at least it's required to build with a 
variety of JDK versions.

I agree that it'd be nice to support downlevel class generation for end 
users. It may even be possible; I haven't dug into build.xml in detail yet.

--
Craig Ringer





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2012-10-16 12:24 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02 04:55 BUG #7577: JDBC Driver - Compiled with Java 7 nicwillemse@gmail.com
2012-10-15 15:10 ` seancompusult <sean@compusult.net>
2012-10-16 02:38   ` Craig Ringer <ringerc@ringerc.id.au>
2012-10-16 12:10     ` Sean Hogan <sean@compusult.net>
2012-10-16 12:24       ` Craig Ringer <ringerc@ringerc.id.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox