Jruby, JDBC

Howdy-
I'm trying to build a simple connection to Oracle using JRuby. I'm a
JRuby newbie, so my method may be quite flawed. But I cannot seem to
get JRuby to recognize jars in the classpath (demonstration below). I
wonder if anyone can see what I'm doing wrong?

$ jar -tf lib/classes12.jar | grep OracleDriver
oracle/jdbc/driver/OracleDriver.class
oracle/jdbc/OracleDriver.class
$ java -classpath "./lib/classes12.jar" -jar
/usr/local/jruby/lib/jruby.jar
require 'java'
include_class 'oracle.jdbc.driver.OracleDriver'
puts 'hi'

C:\jruby\src\builtin\javasupport.rb:258:in `for_name': cannot load Java
class oracle.jdbc.driver.OracleDriver (NameError)
        from C:\jruby\src\builtin\javasupport.rb:258:in
`get_proxy_class'
        from (eval):0:in `include_class'
        from -:2:in `each'
        from C:\jruby\src\builtin\javasupport.rb:405:in `include_class'
        from -:2

$ cat conn_test.java
import oracle.jdbc.driver.OracleDriver;
class conn_test {
  public static void main (String[] args) {
    System.out.println("Hi");
  }
}
$ javac -classpath "lib/classes12.jar" conn_test.java
$ java -classpath ".:lib/classes12.jar" conn_test
Hi

Thanks.
-J

On Wed, 19 Jul 2006, justin.crawford@cusys.edu defenestrated me:

Howdy-
I'm trying to build a simple connection to Oracle using JRuby. I'm a
JRuby newbie, so my method may be quite flawed. But I cannot seem to
get JRuby to recognize jars in the classpath (demonstration below). I
wonder if anyone can see what I'm doing wrong?

$ jar -tf lib/classes12.jar | grep OracleDriver
oracle/jdbc/driver/OracleDriver.class
oracle/jdbc/OracleDriver.class
$ java -classpath "./lib/classes12.jar" -jar
/usr/local/jruby/lib/jruby.jar

  Mixing -classpath and -jar is not allowed in Java. I recommend
using one of the wrapper scripts in ./bin in the jruby distribution:

CLASSPATH=lib/classes12.jar ./bin/jruby some_script

  Any followup Java-specific JRuby questions should be done on our
jruby-user and jruby-devel mailing lists on sourceforge (though
in a very short time we will be moving to codehaus).

-Tom

  PS- You may be the first person to try using the JDBC active record
adapter with Oracle. Report to our lists with any progress you make.

···

--
+ http://www.tc.umn.edu/~enebo +---- mailto:enebo@acm.org ----+

Thomas E Enebo, Protagonist | "Luck favors the prepared |
                             > mind." -Louis Pasteur |