On May 18, 2012, at 14:54 , Alex Mizrahi wrote:
I've got it working once using something like java:jclass in SLIME REPL, but not it doesn't seem to work (in a slightly different environment).
Note that if jar is added to classpath via java commandline Class.forName will work fine. That's probably the easiest way to get it working. Only loading jar dynamically via classloader is a problem.
[…]
Apparently the postgres-jdbc DriverManager API has problems if the 'postgresql.jar' is not on the system classpath, which doesn't seem to be true for the Oracle JDBC classes.
The following uses the getConnection() method directly on the org.postgresql.Driver:
(add-to-classpath "/opt/local/share/java/postgresql.jar") (jcall "connect" (jnew "org.postgresql.Driver") "jdbc:postgresql:test" (jnew "java.util.Properties"))
I would recommend using this over messing with the ABCL classpath, as you'll have to include "extra" instructions to people to use your interface beyond the Lisp code you ship.
P.S. The "-jar" and "-cp" options to Java are always mutually exclusive.