Bugs item #25631, was opened at 2009-04-23 10:24
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=25631&group_id=2014

Category: AR-JDBC
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Guillaume Smet (gsmet)
Assigned to: Nobody (None)
Summary: Problem with getting the JDBC driver with JNDI

Initial Comment:
Hi,

I'm currently trying to port Sonar (sonar.codehaus.org) to PostgreSQL and I 
have a small problem I can't fix by myself.

Sonar is using JNDI and is database agnostic so the driver isn't set in 
database.yml.

With PostgreSQL, it leads to an error in the following line in the 
configure_jndi method of jdbc_adapter.rb:
@config[:driver] = connection.meta_data.connection.java_class.name

connection.meta_data.connection is OK but 
connection.meta_data.connection.java_class raises the following exception: 
wrong # of arguments(0 for 1)

Even if this problem is solved, I still think this line is wrong because 
connection.meta_data.connection returns a org.postgresql.jdbc3.Jdbc3Connection 
object which isn't the driver class (the driver class for PostgreSQL is 
org.postgresql.Driver).

Everything is fine if I configure the driver in database.yml but I'd really 
like to avoid that.

Shouldn't we try to call 
DriverManager.getDriver(connection.getMetaData().getURL()).getName() to get the 
real driver name?

Any comment or help on how to fix this problem?

Thanks in advance.

-- 
Guillaume

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=25631&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to