This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 123671 - Adding postgres JDBC driver for JRuby requires geek skills
Summary: Adding postgres JDBC driver for JRuby requires geek skills
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Platform (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-08 07:37 UTC by Craig Mcclanahan
Modified: 2009-02-19 23:01 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Mcclanahan 2007-12-08 07:37:10 UTC
I want to use JRuby and Rails in an application built with NetBeans 6.  Most of this is easy -- until I tried to use a
Postgres based database.  Then, I encountered the error that org.postgresql.Driver could not be loaded.  There are
actually two different issues here, both of which count as bugs in my book.

* If you right click on the project, select Set Configuration --> Customize and category "Java",
  you can click "Add JAR/Folder" and manually point at the driver JAR file (although the Mac finder
  dialog makes this impossible if you want to use the copy embedded inside NB itself).  However,
  this approach has a fatal flaw -- it updates "nbproject/project.properties" with a path that is
  local to my own development environment, and will create a mess if I check this file into an SCM
  system (very typical for shared developer environments).  Any such settings should be saved in
  the "nbproject/private" directory.

* The only other way I could find to make this work at all was to manually copy (or symlink) the
  Postgres JDBC driver jar into the "lib" directory of the embedded copy of JRuby in use.  This is
  very bad, given the lack of GUI support for the operation, and the fact that symlinks do not exist
  on Windows so it leads to a proliferation of copies of the JAR file.

A "best practices" approach would be to provide a way for the developer to:

* Manage a set of JAR files (or directories) that are implicitly added to the
  class path for *all* Ruby projects.  Or, dreaming big time, a way to set up
  "profiles" of sets of things that could be selected by set-name for a project,
  instead of individually.

* Persist the data behind these choices in nbproject/private, since the paths
  will be unique to a particular developer.  (Alternatively, an analog to the
  way that NB supports "library dependency projects" in the Java world
  would be even better.)

* Some way to share the set of references that a Ruby project requires
  so that other developers can be guided through the required configuration steps
  to make the necessary JAR files available.  The library dependency project approach
  would make lots of sense here.
Comment 1 David Vancouvering 2007-12-10 19:13:09 UTC
I believe this is a P2 because (a) the workaround is ugly and (b) PotsgreSQL support is important to Solaris/Database
strategy, even though one could argue it's not important because there are few PostgreSQL users.  This is something we
hope to change, and making PostgreSQL hard to access doesn't encourage that to happen.
Comment 2 Craig Mcclanahan 2007-12-10 19:39:12 UTC
Note that this issue is not restricted to just adding a Postgres JDBC driver.  The same problem occurs if you want to
add *any* Java class library in a way that causes it to show up in the classpath seen by JRuby.
Comment 3 Erno Mononen 2007-12-11 15:38:46 UTC
I'll have a look at this. Related to this is http://wiki.netbeans.org/wiki/view/OutOfBoxVersionabilityProposal.
Comment 4 Erno Mononen 2008-02-19 19:21:48 UTC
The PostgreSQL drivers (and other JDBC drivers) are now automatically added to the class path, please see http://
wiki.netbeans.org/RubyDatabaseIntegration for more info. Note that a reference to project.properties is only added if 
the referenced file could be referenced using a relative path, otherwise the reference is put to private.properties - 
this applies also to any JAR file added through the project customizer. It is still not ideal, but considering all 
this, I think the issue can be downgraded to P3.
Comment 5 Erno Mononen 2008-12-09 08:35:46 UTC
I think we can close this once issue 138316 is fixed.
Comment 6 Erno Mononen 2009-01-30 11:20:15 UTC
Closing now that issue 138316 is fixed, the drivers and active record jdbc adapters for mysql and postgresql are now 
bundled with the IDE.