You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Scott Anderson <sa...@airvana.com> on 2008/04/04 18:58:09 UTC
Driver+ClassLoader issue
I am using a special wrapper around my Driver so that I don't need to
have the jar on the classpath. This trick clashes with the
DriverDataSource class. Instead of failing immediately if the class
doesn't exist, it might be prudent to check with the
java.sql.DriverManager first - or, heck, even go there first - after
all, that is the standard way of obtaining a Driver.
Regards,
Scott
RE: Driver+ClassLoader issue
Posted by Scott Anderson <sa...@airvana.com>.
Works great, thanks :).
-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org]
Sent: Thursday, April 10, 2008 11:04 AM
To: user@cayenne.apache.org
Subject: Re: Driver+ClassLoader issue
Scott,
I started looking at CAY-1024 patch, and came to a conclusion that
there is a simpler and more consistent solution. Instead of Cayenne
failing over to DriverManager in 'setDriverClassName' (which arguably
can return a driver with a different class name that does not match
the method argument, hence creating confusion), can you simply set the
driver class name to NULL. 'getConnection' method then will consult
DriverManager and return the driver you specified.
Could you check that it works for you?
Thanks
Andrus
On Apr 4, 2008, at 7:58 PM, Scott Anderson wrote:
> I am using a special wrapper around my Driver so that I don't need to
> have the jar on the classpath. This trick clashes with the
> DriverDataSource class. Instead of failing immediately if the class
> doesn't exist, it might be prudent to check with the
> java.sql.DriverManager first - or, heck, even go there first - after
> all, that is the standard way of obtaining a Driver.
>
>
>
> Regards,
>
> Scott
>
Re: Driver+ClassLoader issue
Posted by Andrus Adamchik <an...@objectstyle.org>.
Scott,
I started looking at CAY-1024 patch, and came to a conclusion that
there is a simpler and more consistent solution. Instead of Cayenne
failing over to DriverManager in 'setDriverClassName' (which arguably
can return a driver with a different class name that does not match
the method argument, hence creating confusion), can you simply set the
driver class name to NULL. 'getConnection' method then will consult
DriverManager and return the driver you specified.
Could you check that it works for you?
Thanks
Andrus
On Apr 4, 2008, at 7:58 PM, Scott Anderson wrote:
> I am using a special wrapper around my Driver so that I don't need to
> have the jar on the classpath. This trick clashes with the
> DriverDataSource class. Instead of failing immediately if the class
> doesn't exist, it might be prudent to check with the
> java.sql.DriverManager first - or, heck, even go there first - after
> all, that is the standard way of obtaining a Driver.
>
>
>
> Regards,
>
> Scott
>
Re: Driver+ClassLoader issue
Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Scott,
you may submit a patch via Jira.
Thanks,
Andrus
On Apr 4, 2008, at 7:58 PM, Scott Anderson wrote:
> I am using a special wrapper around my Driver so that I don't need to
> have the jar on the classpath. This trick clashes with the
> DriverDataSource class. Instead of failing immediately if the class
> doesn't exist, it might be prudent to check with the
> java.sql.DriverManager first - or, heck, even go there first - after
> all, that is the standard way of obtaining a Driver.
>
>
>
> Regards,
>
> Scott
>