[regression] JRuby 1.5 doesn't pick up JDBC drivers from CLASSPATH
------------------------------------------------------------------
Key: JRUBY-4795
URL: http://jira.codehaus.org/browse/JRUBY-4795
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.5
Reporter: Vladimir Sizikov
Assignee: Charles Oliver Nutter
This has been reported a couple of times on mailing list:
http://www.ruby-forum.com/topic/209741
http://www.ruby-forum.com/topic/209807
I bisected the problem to the following commit:
commit 61a000f7d152ce79c90a03ea33ab3e357aaca9bc
Date: Sun Apr 11 15:54:21 2010 -0500
When loading classes for JI, don't force them to initialize right away
(needed for compilers, etc, where class will never actually be
executed).
So, basically, doing java_import does not initialize the class
anymore, hence JDBC can't find the driver.
As a workaround, I could recommend the following:
require 'jruby'
java.lang.Class.for_name("com.microsoft.sqlserver.jdbc.SQLServerDriver",
true, JRuby.runtime.jruby_class_loader)
That should fix the problem.
As for the JRuby proper, I'll let Charlie decide, whether to keep the
current behavior or to revert that commit, or something inbetween.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email