[armedbear-devel] Connection to database via JDBC and classpath

Alan Ruttenberg alanruttenberg at gmail.com
Thu May 24 02:30:53 UTC 2012

I have had trouble if there is an associated native library that needs to
be loaded - in that case the java initializer will expect to be able to
load the native library, but I don't know any way to dynamically extend the
native library path. That may not be happening in your case, but I figured
I'd add this factoid to the thread for later searching. If anyone knows how
to actually change java.library.path at run time (and have the change
matter), do let me know.

On Fri, May 18, 2012 at 9:08 AM, Mark Evenson <evenson at panix.com> wrote:

> 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.
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20120523/d5199636/attachment.html>

More information about the armedbear-devel mailing list