You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Rick Hillegas <Ri...@Sun.COM> on 2005/10/10 20:20:11 UTC
conflict between Derby API and JDBC 4.0
I would like advice on how to handle the conflict between the public
Derby API and JDBC 4.0. This issue was raised by Dan in his comments on
bug 587.
A) Does this issue block the submission of the 587 fix?
B) How do we want to handle this conflict in 10.2?
The problem is that some javax.sql interfaces are incompatible between
jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
run on both the 1.4 and 1.6 vms. This is a showstopper for Derby because
i) our public API contains classes which implement these incompatible
interfaces and ii) we ship a single jar which we expect will run on all
supported vms. The comments on bug 587 suggest some solutions:
1) Some, as yet not understood, classloader trick.
2) Abandon requirement (ii) and release separate Derby deployments for
1.4 and 1.6.
3) Change our public API.
I would appreciate some discussion of this serious problem.
Thanks,
-Rick
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@debrunners.com>.
David W. Van Couvering wrote:
> Hi, Rick. You had my vote, item 3 (although I don't understand how it
> would change our public API, I didn't know EmbeddedDataSource was a
> public (e.g. for-customer-use) API).
http://db.apache.org/derby/javadoc/publishedapi/
driven off the publishedapi javadoc target in the top-level build.xml file.
Dan.
Re: conflict between Derby API and JDBC 4.0
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Hi, Rick. You had my vote, item 3 (although I don't understand how it
would change our public API, I didn't know EmbeddedDataSource was a
public (e.g. for-customer-use) API).
I would suggest proposing what you think is the best solution and I
suspect you'll get some feedback. If you don't, you can assume lazy
consensus and do what you think is best (although I suspect you *will*
get some feedback :) ).
David
Rick Hillegas wrote:
> I would like advice on how to handle the conflict between the public
> Derby API and JDBC 4.0. This issue was raised by Dan in his comments on
> bug 587.
>
> A) Does this issue block the submission of the 587 fix?
>
> B) How do we want to handle this conflict in 10.2?
>
> The problem is that some javax.sql interfaces are incompatible between
> jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
> run on both the 1.4 and 1.6 vms. This is a showstopper for Derby because
> i) our public API contains classes which implement these incompatible
> interfaces and ii) we ship a single jar which we expect will run on all
> supported vms. The comments on bug 587 suggest some solutions:
>
> 1) Some, as yet not understood, classloader trick.
>
> 2) Abandon requirement (ii) and release separate Derby deployments for
> 1.4 and 1.6.
>
> 3) Change our public API.
>
> I would appreciate some discussion of this serious problem.
>
> Thanks,
> -Rick
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@apache.org>.
Rick Hillegas wrote:
> Thanks to everyone who responded to the proposal I circulated earlier
> this week. I will attempt to recap the discussion:
>
> o JDBC3 DataSources do not satisfy the contract for JDBC4.
> o Loading a JDBC4 DataSource into a 1.4 VM raises
> java.lang.UnsupportedClassVersionError. David and I are scared by the
> suggestion that we fiddle the byte code of the JDBC4 DataSources to
> trick the 1.4 VM.
> o App servers will break under my proposal to move DataSource
> instantiation into factory methods. This is because app servers declare
> the DataSource classes in ConnectionPool settings and so expect
> DataSources to have public, no-arg constructors.
>
> Here is a new, simpler proposal:
>
> o 10.2 will ship with two sets of DataSources, one for JDBC3 and one for
> JDBC4.
> o The user documentation will advise customers to use VM-appropriate
> DataSources.
> o Existing Derby apps will continue to work on the 1.6 VM.
> o Customers will have to recode their existing Derby applications if
> they want to invoke new JDBC4 methods. That is, the applications will
> have to instantiate JDBC4 DataSources rather than JDBC3 DataSources.
I agree with the general thoughts above, but I belive the details are a
little different.
> o 10.2 will ship with two sets of DataSources, one for JDBC3 and one for
> JDBC4.
The "JDBC 3.0" DataSource implementations themselves will not implement
the JDBC 4.0 contract for javax.sql.DataSource, ConnectionPoolDataSource
and XADataSource, but Connection objects returned from them will honour
the JDBC 4.0 Connection contract.
> o Customers will have to recode their existing Derby applications if
> they want to invoke new JDBC4 methods. That is, the applications will
> have to instantiate JDBC4 DataSources rather than JDBC3 DataSources.
Append "on the DataSource interfaces" after "invoke new JDBC4 methods".
Dan.
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@apache.org>.
David W. Van Couvering wrote:
> This means if someone runs an app build against JDK 1.6 under a 1.5 or
> earlier VM they will get a runtime exception, and we should document
> what this exception is so that users know exactly what is wrong when
> they get it. We should also warn developers that if they write code
> against JDBC4 it will not work with a 1.5 or earlier VM.
I've always thought the Derby documentation should not be documenting
information more relevant and usually better documented elsewhere. IMO
it's enough to say that JDBC 4.0 requires JDK 1.6. I'm not sure we can
determine what exception a JDBC 4.0 application running on JDK 1.5 or
earlier will get, the application may itself use generics and hit
problems before it loads any Derby code.
> By the way, wouldn't this be true for any application written against
> JDBC, regardless of what driver is being used? Or am I missing something?
It's true for any application that takes advantage of features that are
not in an earlier VM or not in a VM of a different configuration.
Dan.
Re: conflict between Derby API and JDBC 4.0
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
This seems reasonable and what I would expect of anyone wanting to take
advantage of new functionality that is not available on old interfaces.
We do not break backward compatibility, but we do break
forward-compatibility (actually, it is JDBC that does this).
This means if someone runs an app build against JDK 1.6 under a 1.5 or
earlier VM they will get a runtime exception, and we should document
what this exception is so that users know exactly what is wrong when
they get it. We should also warn developers that if they write code
against JDBC4 it will not work with a 1.5 or earlier VM.
By the way, wouldn't this be true for any application written against
JDBC, regardless of what driver is being used? Or am I missing something?
David
Rick Hillegas wrote:
> Thanks to everyone who responded to the proposal I circulated earlier
> this week. I will attempt to recap the discussion:
>
> o JDBC3 DataSources do not satisfy the contract for JDBC4.
> o Loading a JDBC4 DataSource into a 1.4 VM raises
> java.lang.UnsupportedClassVersionError. David and I are scared by the
> suggestion that we fiddle the byte code of the JDBC4 DataSources to
> trick the 1.4 VM.
> o App servers will break under my proposal to move DataSource
> instantiation into factory methods. This is because app servers declare
> the DataSource classes in ConnectionPool settings and so expect
> DataSources to have public, no-arg constructors.
>
> Here is a new, simpler proposal:
>
> o 10.2 will ship with two sets of DataSources, one for JDBC3 and one for
> JDBC4.
> o The user documentation will advise customers to use VM-appropriate
> DataSources.
> o Existing Derby apps will continue to work on the 1.6 VM.
> o Customers will have to recode their existing Derby applications if
> they want to invoke new JDBC4 methods. That is, the applications will
> have to instantiate JDBC4 DataSources rather than JDBC3 DataSources.
>
> I appreciate your continued feedback.
>
> Thanks,
> -Rick
>
>>
>>
>> Rick Hillegas wrote:
>>
>>> Thanks, Dan. For the record, I think that this affects
>>> org.apache.derby.jdbc as follows:
>>>
>>> - ClientConnectionPoolDataSource (implements
>>> javax.sql.ConnectionPoolDataSource, which extends
>>> javax.sql.CommonDataSource, which mentions QueryObjectGenerator,
>>> which is new to 1.6 and mentions generics).
>>> - ClientDataSource (implements javax.sql.DataSource, which mentions
>>> generics)
>>> - ClientXADataSource (same as ClientDataSource)
>>> - EmbeddedConnectionPoolDataSource (same as ClientDataSource)
>>> - EmbeddedDataSource (same as ClientDataSource)
>>> - EmbeddedSimpleDataSource (same as ClientDataSource)
>>> - EmbeddedXADataSource (same as ClientDataSource)
>>>
>>> Regards,
>>> -Rick
>>>
>>> Daniel John Debrunner wrote:
>>>
>>>> Rick Hillegas wrote:
>>>>
>>>>
>>>>
>>>>> I would like advice on how to handle the conflict between the public
>>>>> Derby API and JDBC 4.0. This issue was raised by Dan in his
>>>>> comments on
>>>>> bug 587.
>>>>>
>>>>> A) Does this issue block the submission of the 587 fix?
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> I don't think so. But I think we would want to resolve the issue before
>>>> release a Derby version that contained this code. Though potentially
>>>> resolution could wait until JDBC 4.0 was official.
>>>>
>>>>
>>>>
>>>>> B) How do we want to handle this conflict in 10.2?
>>>>>
>>>>> The problem is that some javax.sql interfaces are incompatible between
>>>>> jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
>>>>> run on both the 1.4 and 1.6 vms. This is a showstopper for Derby
>>>>> because
>>>>> i) our public API contains classes which implement these incompatible
>>>>> interfaces and ii) we ship a single jar which we expect will run on
>>>>> all
>>>>> supported vms. The comments on bug 587 suggest some solutions:
>>>>>
>>>>> 1) Some, as yet not understood, classloader trick.
>>>>>
>>>>> 2) Abandon requirement (ii) and release separate Derby deployments for
>>>>> 1.4 and 1.6.
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> I would say 2) is out, it seems overkill for a single class to drive a
>>>> switch to multiple/different versions for different environments.
>>>>
>>>>
>>>>
>>>>
>>>>> 3) Change our public API.
>>>>>
>>>>> I would appreciate some discussion of this serious problem.
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Beyond that, I will think more :-)
>>>>
>>>> Dan.
>>>>
>>>>
>>>>
>>>
>>
>
Re: conflict between Derby API and JDBC 4.0
Posted by Rick Hillegas <Ri...@Sun.COM>.
Thanks to everyone who responded to the proposal I circulated earlier
this week. I will attempt to recap the discussion:
o JDBC3 DataSources do not satisfy the contract for JDBC4.
o Loading a JDBC4 DataSource into a 1.4 VM raises
java.lang.UnsupportedClassVersionError. David and I are scared by the
suggestion that we fiddle the byte code of the JDBC4 DataSources to
trick the 1.4 VM.
o App servers will break under my proposal to move DataSource
instantiation into factory methods. This is because app servers declare
the DataSource classes in ConnectionPool settings and so expect
DataSources to have public, no-arg constructors.
Here is a new, simpler proposal:
o 10.2 will ship with two sets of DataSources, one for JDBC3 and one for
JDBC4.
o The user documentation will advise customers to use VM-appropriate
DataSources.
o Existing Derby apps will continue to work on the 1.6 VM.
o Customers will have to recode their existing Derby applications if
they want to invoke new JDBC4 methods. That is, the applications will
have to instantiate JDBC4 DataSources rather than JDBC3 DataSources.
I appreciate your continued feedback.
Thanks,
-Rick
>
>
> Rick Hillegas wrote:
>
>> Thanks, Dan. For the record, I think that this affects
>> org.apache.derby.jdbc as follows:
>>
>> - ClientConnectionPoolDataSource (implements
>> javax.sql.ConnectionPoolDataSource, which extends
>> javax.sql.CommonDataSource, which mentions QueryObjectGenerator,
>> which is new to 1.6 and mentions generics).
>> - ClientDataSource (implements javax.sql.DataSource, which mentions
>> generics)
>> - ClientXADataSource (same as ClientDataSource)
>> - EmbeddedConnectionPoolDataSource (same as ClientDataSource)
>> - EmbeddedDataSource (same as ClientDataSource)
>> - EmbeddedSimpleDataSource (same as ClientDataSource)
>> - EmbeddedXADataSource (same as ClientDataSource)
>>
>> Regards,
>> -Rick
>>
>> Daniel John Debrunner wrote:
>>
>>> Rick Hillegas wrote:
>>>
>>>
>>>
>>>> I would like advice on how to handle the conflict between the public
>>>> Derby API and JDBC 4.0. This issue was raised by Dan in his
>>>> comments on
>>>> bug 587.
>>>>
>>>> A) Does this issue block the submission of the 587 fix?
>>>>
>>>
>>>
>>>
>>> I don't think so. But I think we would want to resolve the issue before
>>> release a Derby version that contained this code. Though potentially
>>> resolution could wait until JDBC 4.0 was official.
>>>
>>>
>>>
>>>> B) How do we want to handle this conflict in 10.2?
>>>>
>>>> The problem is that some javax.sql interfaces are incompatible between
>>>> jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
>>>> run on both the 1.4 and 1.6 vms. This is a showstopper for Derby
>>>> because
>>>> i) our public API contains classes which implement these incompatible
>>>> interfaces and ii) we ship a single jar which we expect will run on
>>>> all
>>>> supported vms. The comments on bug 587 suggest some solutions:
>>>>
>>>> 1) Some, as yet not understood, classloader trick.
>>>>
>>>> 2) Abandon requirement (ii) and release separate Derby deployments for
>>>> 1.4 and 1.6.
>>>>
>>>
>>>
>>>
>>> I would say 2) is out, it seems overkill for a single class to drive a
>>> switch to multiple/different versions for different environments.
>>>
>>>
>>>
>>>
>>>> 3) Change our public API.
>>>>
>>>> I would appreciate some discussion of this serious problem.
>>>>
>>>
>>>
>>>
>>> Beyond that, I will think more :-)
>>>
>>> Dan.
>>>
>>>
>>>
>>
>
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@apache.org>.
David W. Van Couvering wrote:
> I really really don't want to see us modifying the class to indicate a
> different class version. This path seems fraught with peril; this type
> of "white lie" (actually it's a pretty big lie) seems to me fraught with
> peril; who knows what other functionality depends on correct versioning
> of the class file?
That should be well defined by the JVM specification and updates from
Sun. Though I've never seen any definition of what the class major and
minor version imply, makes it hard to generate byte code. :-( I've
mentioned this to the J2SE spec lead before, though it was over beers.
Dan.
Re: conflict between Derby API and JDBC 4.0
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
I really really don't want to see us modifying the class to indicate a
different class version. This path seems fraught with peril; this type
of "white lie" (actually it's a pretty big lie) seems to me fraught with
peril; who knows what other functionality depends on correct versioning
of the class file?
David
Andrew McIntyre wrote:
>
> On Jan 24, 2006, at 5:13 PM, Daniel John Debrunner wrote:
>
>> Are generics represented by new entries in the class file that break on
>>
>> older VMs?
>>
>
> This question caught my eye, and I did a little research. The answer is
> both yes and no.
>
> The bytecode for generics is compatible with older VMs because the
> generic type signature is erased at compile time and appropriate casts
> added by the compiler. The new methods could be used in the older VM,
> but casts which were not expected when the newer class was compiled
> would result in a ClassCastException.
>
> But, attempting to load a class with generics compiled with 1.5/1.6 in a
> 1.4 JVM yields this error:
>
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> Generic (Unsupported major.minor version 49.0)
>
> It is also not possible to compile a class with generics with -target 1.4.
>
> But, you could change the class version so that the class got past the
> verifier on the earlier VM and it would still work. I even verified that
> this would work with a simple test case. I haven't had time to look at
> whether the new methods with generics have counterparts in JDBC 3.0, but
> assuming they don't, and the JSR-014 charter says that JDBC 4.0 should
> be backwards compatible with JDBC 3.0, altering the class version would
> do the trick.
>
> But, then you've entered the dreaded area of modifying class files
> post-compilation. :-)
>
> Also, I found this
> document: http://homepages.inf.ed.ac.uk/wadler/gj/Documents/gj-oopsla.pdf
> very enlightening as to the mechanics of how generic types are handled
> in the compiler. It was linked from the JSR-014 page.
>
> andrew
Re: conflict between Derby API and JDBC 4.0
Posted by "Lance J. Andersen" <La...@Sun.COM>.
Generics can be used on signatures for existing methods when it makes
sense. If you look at Java SE 5.0, you will see many methods whose
signatures changed (Collections API is an obvious example) without
breaking compatibility with earlier code at runtime.
-lance
Andrew McIntyre wrote:
>
> On Jan 24, 2006, at 11:28 PM, Andrew McIntyre wrote:
>
>> and the JSR-014 charter says that JDBC 4.0 should be backwards
>> compatible with JDBC 3.0
>
>
> I meant JSR-221 here. A quick scan of the specs and javadoc that
> didn't require a license agreement seem to indicate that generics are
> only used on methods new to JDBC 4.0.
>
> andrew
Re: conflict between Derby API and JDBC 4.0
Posted by Andrew McIntyre <mc...@gmail.com>.
On Jan 24, 2006, at 11:28 PM, Andrew McIntyre wrote:
> and the JSR-014 charter says that JDBC 4.0 should be backwards
> compatible with JDBC 3.0
I meant JSR-221 here. A quick scan of the specs and javadoc that
didn't require a license agreement seem to indicate that generics are
only used on methods new to JDBC 4.0.
andrew
Re: conflict between Derby API and JDBC 4.0
Posted by Andrew McIntyre <mc...@gmail.com>.
On Jan 24, 2006, at 5:13 PM, Daniel John Debrunner wrote:
> Are generics represented by new entries in the class file that
> break on
> older VMs?
This question caught my eye, and I did a little research. The answer
is both yes and no.
The bytecode for generics is compatible with older VMs because the
generic type signature is erased at compile time and appropriate
casts added by the compiler. The new methods could be used in the
older VM, but casts which were not expected when the newer class was
compiled would result in a ClassCastException.
But, attempting to load a class with generics compiled with 1.5/1.6
in a 1.4 JVM yields this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError:
Generic (Unsupported major.minor version 49.0)
It is also not possible to compile a class with generics with -target
1.4.
But, you could change the class version so that the class got past
the verifier on the earlier VM and it would still work. I even
verified that this would work with a simple test case. I haven't had
time to look at whether the new methods with generics have
counterparts in JDBC 3.0, but assuming they don't, and the JSR-014
charter says that JDBC 4.0 should be backwards compatible with JDBC
3.0, altering the class version would do the trick.
But, then you've entered the dreaded area of modifying class files
post-compilation. :-)
Also, I found this document: http://homepages.inf.ed.ac.uk/wadler/gj/
Documents/gj-oopsla.pdf very enlightening as to the mechanics of how
generic types are handled in the compiler. It was linked from the
JSR-014 page.
andrew
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@apache.org>.
Rick Hillegas wrote:
> Three months ago, we shelved this topic, promising to return to it
> later. I would like to reach consensus on this problem now. In a
> nutshell: JDBC4 introduces new methods whose signatures contain
> generics.
Are generics represented by new entries in the class file that break on
older VMs?
> Because of this, DataSource implementations can't satisfy both
> the JDBC3 and JDBC4 contracts. I would like to restart the discussion by
> proposing the following:
>
> 1) Derby's public API will contain two sets of DataSource
> implementations, one which satisfies the JDBC3 contract and one which
> satisfies JDBC4.
>
> 2) The documented, approved way to obtain DataSources will be to call
> factory methods on EmbeddedDriver and ClientDriver. These factory
> methods will hand back either JDBC3 or JDBC4 DataSources depending on
> the vm.
-1 Breaks the established pattern of how DataSource objects are used.
>
> 3) JDBC4 DataSources will have private constructors.
-1 Breaks the established pattern of how DataSource objects are used.
> 4) In contrast, the JDBC3 DataSources will continue to expose public
> constructors. Existing Derby applications won't have to change,
+1
> provided that they are run on jdk1.3, jdk1.4, or jdk1.5.
-1 Much like I expect a application written against JDK 1.4 to run on
JDK 1.5, shouldn't I expect an application written against JDK 1.4 to
run on 1.6? Or is there some change in Java binary compatibility I'm
unaware of?
> 5) However, we will raise exceptions if applications try to construct
> JDBC3 DataSources while running on jdk1.6. The exceptions will tell the
> customer to call the appropriate factory methods.
-1 JDBC 3.0 DataSources/applications should work fine on JDK 1.6/JDBC
4.0. Again, unless Java binary compatibility is broken.
> Note that this describes the behavior of Derby 10.2. We make no promises
> about what will happen if the customer tries to run earlier versions of
> Derby on jdk1.6. Under those combinations, the customer will see runtime
> exceptions when trying to invoke JDBC4-specific methods.
I agree with this, Derby 10.0 and 10.1 do not support JDBC 4.0, so
calling JDBC 4.0 methods against their drivers/data sources etc. will
lead to abstract method exceptions or similar.
Dan.
Re: conflict between Derby API and JDBC 4.0
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Rick Hillegas wrote:
> Three months ago, we shelved this topic, promising to return to it
> later. I would like to reach consensus on this problem now. In a
> nutshell: JDBC4 introduces new methods whose signatures contain
> generics. Because of this, DataSource implementations can't satisfy both
> the JDBC3 and JDBC4 contracts. I would like to restart the discussion by
> proposing the following:
>
> 1) Derby's public API will contain two sets of DataSource
> implementations, one which satisfies the JDBC3 contract and one which
> satisfies JDBC4.
>
> 2) The documented, approved way to obtain DataSources will be to call
> factory methods on EmbeddedDriver and ClientDriver. These factory
> methods will hand back either JDBC3 or JDBC4 DataSources depending on
> the vm.
How does this work in app server environments where you simply specify
the DataSource class name directly in the settings for a connection
pool? Do I as someone deploying into an app server have to choose which
Derby DataSource to use?
Also, you have described the public API. Am I to assume that internally
the JDBC 4 DataSource will somehow be able to take advantage of the
inheritance framework that currently exists today?
It also seems a little odd to have EmbeddedDriver/ClientDriver be a
factory for DataSource which then uses EmbeddedDriver/ClientDriver to
manufacture connections... I guess it's OK, but I worry about circular
dependencies...
Will there also be separate XADataSource and ConnectionPoolDataSource
implementations for JDBC3-- and JDBC4++?
David
Re: conflict between Derby API and JDBC 4.0
Posted by "Lance J. Andersen" <La...@Sun.COM>.
Daniel John Debrunner wrote:
>Rick Hillegas wrote:
>
>
>
>>Three months ago, we shelved this topic, promising to return to it
>>later. I would like to reach consensus on this problem now. In a
>>nutshell: JDBC4 introduces new methods whose signatures contain
>>generics. Because of this, DataSource implementations can't satisfy both
>>the JDBC3 and JDBC4 contracts.
>>
>>
>
>So that's not quite true, a JDBC 4.0 DataSource implementation does
>satisfy both JDBC 4.0 and JDBC 3.0. I've been looking at if it would be
>possible to have a single implementation that worked in both. Ie. would
>the reference to new classes and the generics absolutely make the class
>not work in JDBC 3.0. Most likely yes, but it's worth throwing out there.
>
>One question I do have on the JDBC 4.0 spec, is what is the purpose of
>this method in javax.sql.DataSource?
>
><T> T createQueryObject(java.lang.Class<T> ifc)
> throws SQLException
>
>For some reason it's not seen as required for a ConnectionPoolDataSource
>or an XADataSource, so why is it needed on DataSource?
>
>
This is there as an EoD feature for Java EE developers. Java EE apps
deal with DataSources not usually directly with XADataSources or
ConnectionPoolDataSources.
DataSets layer Rowsets and ResultSets. RowSets already accept a
DataSource instead of a Connection object.
Often a DataSource is typically implemented by application server.
Application server's
implementation of DataSource will implement the createQueryObject method.
That will result in a call such as
return
underlyingDataSource.getQueryObjectGenerator().createQueryObject(ifc, this);
>As far as I can tell it seems to be a short-cut for
>
>getConnection().createQueryObject(java.lang.Class<T> ifc)
>
>(using the getConnection() method on javax.sql.DataSource).
>
>Should we ask this question to the JDBC 4.0 review?
>
>The whole ease of section 20.1 in JDBC 4.0 I'd assumed would be above
>the level of the JDBC driver, it's somewhat disconcerting to me that
>it's that closely linked to the low level driver.
>
>Related to that, does anyone have any idea how the QueryObjectGenerator
>interface is meant to be used. What piece of code would call
>CommonDataSource.getQueryObjectGenerator()? Would it be a wrapping
>DataSource implementation (e.g. from a app server). Section 20.1.6 seems
>to be no help here. Section 20.2.2.1 has this sentence:
>
>"If the JDBC driver does not provide its
>own implementation of a QueryObjectGenerator, it must invoke the default
>QueryObjectGenerator implementation provided by Java SE 6."
>
>I can't see any mention of how a driver implementation finds the
>defaultQueryObjectGenerator implementation.
>
>
>Dan.
>
>
>
Re: conflict between Derby API and JDBC 4.0
Posted by Anurag Shekhar <An...@Sun.COM>.
>>Three months ago, we shelved this topic, promising to return to it
>>later. I would like to reach consensus on this problem now. In a
>>nutshell: JDBC4 introduces new methods whose signatures contain
>>generics. Because of this, DataSource implementations can't satisfy both
>>the JDBC3 and JDBC4 contracts.
>>
>>
>
>So that's not quite true, a JDBC 4.0 DataSource implementation does
>satisfy both JDBC 4.0 and JDBC 3.0. I've been looking at if it would be
>possible to have a single implementation that worked in both. Ie. would
>the reference to new classes and the generics absolutely make the class
>not work in JDBC 3.0. Most likely yes, but it's worth throwing out there.
>
>
Generics can be compiled jdk 1.5 or higher. And class generated with
jdk1.5 or higher are not
compatible with the older vm s.
anurag
Re: conflict between Derby API and JDBC 4.0
Posted by Anurag Shekhar <An...@Sun.COM>.
>o be no help here. Section 20.2.2.1 has this sentence:
>
>"If the JDBC driver does not provide its
>own implementation of a QueryObjectGenerator, it must invoke the default
>QueryObjectGenerator implementation provided by Java SE 6."
>
>I can't see any mention of how a driver implementation finds the
>defaultQueryObjectGenerator implementation.
>
>
>
>
defaultQueryObjectGenerator can be invoked using
public static <T extends BaseQuery> T
createDefaultQueryObject(java.lang.Class<T> ifc,
Connection con)
or
public static <T extends BaseQuery> T
createDefaultQueryObject(java.lang.Class<T> ifc,
DataSource ds)
throws SQLException
on
java.sql.QueryObjectFactory
anurag
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@apache.org>.
Rick Hillegas wrote:
> Three months ago, we shelved this topic, promising to return to it
> later. I would like to reach consensus on this problem now. In a
> nutshell: JDBC4 introduces new methods whose signatures contain
> generics. Because of this, DataSource implementations can't satisfy both
> the JDBC3 and JDBC4 contracts.
So that's not quite true, a JDBC 4.0 DataSource implementation does
satisfy both JDBC 4.0 and JDBC 3.0. I've been looking at if it would be
possible to have a single implementation that worked in both. Ie. would
the reference to new classes and the generics absolutely make the class
not work in JDBC 3.0. Most likely yes, but it's worth throwing out there.
One question I do have on the JDBC 4.0 spec, is what is the purpose of
this method in javax.sql.DataSource?
<T> T createQueryObject(java.lang.Class<T> ifc)
throws SQLException
For some reason it's not seen as required for a ConnectionPoolDataSource
or an XADataSource, so why is it needed on DataSource?
As far as I can tell it seems to be a short-cut for
getConnection().createQueryObject(java.lang.Class<T> ifc)
(using the getConnection() method on javax.sql.DataSource).
Should we ask this question to the JDBC 4.0 review?
The whole ease of section 20.1 in JDBC 4.0 I'd assumed would be above
the level of the JDBC driver, it's somewhat disconcerting to me that
it's that closely linked to the low level driver.
Related to that, does anyone have any idea how the QueryObjectGenerator
interface is meant to be used. What piece of code would call
CommonDataSource.getQueryObjectGenerator()? Would it be a wrapping
DataSource implementation (e.g. from a app server). Section 20.1.6 seems
to be no help here. Section 20.2.2.1 has this sentence:
"If the JDBC driver does not provide its
own implementation of a QueryObjectGenerator, it must invoke the default
QueryObjectGenerator implementation provided by Java SE 6."
I can't see any mention of how a driver implementation finds the
defaultQueryObjectGenerator implementation.
Dan.
Re: conflict between Derby API and JDBC 4.0
Posted by Rick Hillegas <Ri...@Sun.COM>.
Three months ago, we shelved this topic, promising to return to it
later. I would like to reach consensus on this problem now. In a
nutshell: JDBC4 introduces new methods whose signatures contain
generics. Because of this, DataSource implementations can't satisfy both
the JDBC3 and JDBC4 contracts. I would like to restart the discussion by
proposing the following:
1) Derby's public API will contain two sets of DataSource
implementations, one which satisfies the JDBC3 contract and one which
satisfies JDBC4.
2) The documented, approved way to obtain DataSources will be to call
factory methods on EmbeddedDriver and ClientDriver. These factory
methods will hand back either JDBC3 or JDBC4 DataSources depending on
the vm.
3) JDBC4 DataSources will have private constructors.
4) In contrast, the JDBC3 DataSources will continue to expose public
constructors. Existing Derby applications won't have to change, provided
that they are run on jdk1.3, jdk1.4, or jdk1.5.
5) However, we will raise exceptions if applications try to construct
JDBC3 DataSources while running on jdk1.6. The exceptions will tell the
customer to call the appropriate factory methods.
Note that this describes the behavior of Derby 10.2. We make no promises
about what will happen if the customer tries to run earlier versions of
Derby on jdk1.6. Under those combinations, the customer will see runtime
exceptions when trying to invoke JDBC4-specific methods.
Please let me know what you think.
Thanks,
-Rick
Rick Hillegas wrote:
> Thanks, Dan. For the record, I think that this affects
> org.apache.derby.jdbc as follows:
>
> - ClientConnectionPoolDataSource (implements
> javax.sql.ConnectionPoolDataSource, which extends
> javax.sql.CommonDataSource, which mentions QueryObjectGenerator, which
> is new to 1.6 and mentions generics).
> - ClientDataSource (implements javax.sql.DataSource, which mentions
> generics)
> - ClientXADataSource (same as ClientDataSource)
> - EmbeddedConnectionPoolDataSource (same as ClientDataSource)
> - EmbeddedDataSource (same as ClientDataSource)
> - EmbeddedSimpleDataSource (same as ClientDataSource)
> - EmbeddedXADataSource (same as ClientDataSource)
>
> Regards,
> -Rick
>
> Daniel John Debrunner wrote:
>
>> Rick Hillegas wrote:
>>
>>
>>
>>> I would like advice on how to handle the conflict between the public
>>> Derby API and JDBC 4.0. This issue was raised by Dan in his comments on
>>> bug 587.
>>>
>>> A) Does this issue block the submission of the 587 fix?
>>>
>>
>>
>> I don't think so. But I think we would want to resolve the issue before
>> release a Derby version that contained this code. Though potentially
>> resolution could wait until JDBC 4.0 was official.
>>
>>
>>
>>> B) How do we want to handle this conflict in 10.2?
>>>
>>> The problem is that some javax.sql interfaces are incompatible between
>>> jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
>>> run on both the 1.4 and 1.6 vms. This is a showstopper for Derby
>>> because
>>> i) our public API contains classes which implement these incompatible
>>> interfaces and ii) we ship a single jar which we expect will run on all
>>> supported vms. The comments on bug 587 suggest some solutions:
>>>
>>> 1) Some, as yet not understood, classloader trick.
>>>
>>> 2) Abandon requirement (ii) and release separate Derby deployments for
>>> 1.4 and 1.6.
>>>
>>
>>
>> I would say 2) is out, it seems overkill for a single class to drive a
>> switch to multiple/different versions for different environments.
>>
>>
>>
>>
>>> 3) Change our public API.
>>>
>>> I would appreciate some discussion of this serious problem.
>>>
>>
>>
>> Beyond that, I will think more :-)
>>
>> Dan.
>>
>>
>>
>
Re: conflict between Derby API and JDBC 4.0
Posted by Rick Hillegas <Ri...@Sun.COM>.
Thanks, Dan. For the record, I think that this affects
org.apache.derby.jdbc as follows:
- ClientConnectionPoolDataSource (implements
javax.sql.ConnectionPoolDataSource, which extends
javax.sql.CommonDataSource, which mentions QueryObjectGenerator, which
is new to 1.6 and mentions generics).
- ClientDataSource (implements javax.sql.DataSource, which mentions
generics)
- ClientXADataSource (same as ClientDataSource)
- EmbeddedConnectionPoolDataSource (same as ClientDataSource)
- EmbeddedDataSource (same as ClientDataSource)
- EmbeddedSimpleDataSource (same as ClientDataSource)
- EmbeddedXADataSource (same as ClientDataSource)
Regards,
-Rick
Daniel John Debrunner wrote:
>Rick Hillegas wrote:
>
>
>
>>I would like advice on how to handle the conflict between the public
>>Derby API and JDBC 4.0. This issue was raised by Dan in his comments on
>>bug 587.
>>
>>A) Does this issue block the submission of the 587 fix?
>>
>>
>
>I don't think so. But I think we would want to resolve the issue before
>release a Derby version that contained this code. Though potentially
>resolution could wait until JDBC 4.0 was official.
>
>
>
>>B) How do we want to handle this conflict in 10.2?
>>
>>The problem is that some javax.sql interfaces are incompatible between
>>jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
>>run on both the 1.4 and 1.6 vms. This is a showstopper for Derby because
>>i) our public API contains classes which implement these incompatible
>>interfaces and ii) we ship a single jar which we expect will run on all
>>supported vms. The comments on bug 587 suggest some solutions:
>>
>>1) Some, as yet not understood, classloader trick.
>>
>>2) Abandon requirement (ii) and release separate Derby deployments for
>>1.4 and 1.6.
>>
>>
>
>I would say 2) is out, it seems overkill for a single class to drive a
>switch to multiple/different versions for different environments.
>
>
>
>
>>3) Change our public API.
>>
>>I would appreciate some discussion of this serious problem.
>>
>>
>
>Beyond that, I will think more :-)
>
>Dan.
>
>
>
Re: conflict between Derby API and JDBC 4.0
Posted by Daniel John Debrunner <dj...@debrunners.com>.
Rick Hillegas wrote:
> I would like advice on how to handle the conflict between the public
> Derby API and JDBC 4.0. This issue was raised by Dan in his comments on
> bug 587.
>
> A) Does this issue block the submission of the 587 fix?
I don't think so. But I think we would want to resolve the issue before
release a Derby version that contained this code. Though potentially
resolution could wait until JDBC 4.0 was official.
>
> B) How do we want to handle this conflict in 10.2?
>
> The problem is that some javax.sql interfaces are incompatible between
> jdk1.4 and jdk1.6. A class implementing one of these interfaces can't
> run on both the 1.4 and 1.6 vms. This is a showstopper for Derby because
> i) our public API contains classes which implement these incompatible
> interfaces and ii) we ship a single jar which we expect will run on all
> supported vms. The comments on bug 587 suggest some solutions:
>
> 1) Some, as yet not understood, classloader trick.
>
> 2) Abandon requirement (ii) and release separate Derby deployments for
> 1.4 and 1.6.
I would say 2) is out, it seems overkill for a single class to drive a
switch to multiple/different versions for different environments.
> 3) Change our public API.
>
> I would appreciate some discussion of this serious problem.
Beyond that, I will think more :-)
Dan.