db inspection not working when using heroku's postgres.app

I have used RubyMine with brew install of postgres for ages with rails 3.2 apps - works great.

On a new laptop I instead installed heroku's new postgres.app (postgressapp.com) that provides postgres on port 5432 as usual with the same app which includes the pg gem.

Using RubyMine 5.0.1 I can open a rails console and get model counts etc just fine, ActiveRecord works great, and the Database panel correctly shows the postgres schema and I can drill down to columns etc. However, when I try to open a table (F4) or run a psql console (~F10) I get this error stack:

[2013-02-17 10:11:32] Exception in thread "main" java.lang.ClassNotFoundException: org.postgresql.Driver
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:169)
 at com.intellij.persistence.database.console.RemoteJdbcServer.main(RemoteJdbcServer.java:15)

Am I missing something incredibly simple?

Please check that the datasource properties are correct in Database toolwindow.
It looks like some postgresql-XXX.jar is missing in JDBC driver files field.


Thanks Gregory! You gave me the clue I needed. Here's what I did to make it work for anyone else with this problem. Turns out the Heroku postgres.app has nothing to do with it.

For whatever reason I didn't have a jdbc driver installed for the data source console. The rails pg gem provided postgres db connectivity for the application and rails console just fine -- it had no problem connecting to the pg.app from heroku.

To install the jdbc drivers, right click on the database name in the Database Panel and select Properties.

From the jdbc driver dropdown, select your preferred driver; for me it was postgresql-9.2-jdbc.jar -- any of them will work fine for a modern application.

Then you need to download the drivers unless they are persent on your machine. To assist, Rubymine opens a dialog panel to download and asks where to store them. On a mac you want to store them:
Library/Preferences/RubyMine50/jdbc-drivers. Create this folder if it does not yet exist, then select it.

Point Rubymine to the postgres URL. Heroku's postgres.app opens on the usual port on the local machine so you can use a URL like:

Rubymine downloads the drivers and everything works.



Please sign in to leave a comment.