today I’ve switch from jruby-1.1.RC3 to jruby-1.1.3
I’m using to jdbc connectors, installed by gem :
jdbc-mysql-5.0.4
jdbc-sqlite3-3.5.8
I’ve set my CLASSPATH to :
export
CLASSPATH=".:/opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/jdbc-sqlite3-3.5.8/
lib/sqlite-3.5.8.jar:/opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/jdbc-mysql-
5.0.4/lib/mysql-connector-java-5.0.4-bin.jar"
If i echo the “–classpath” of /opt/jruby-1.1.3/bin/jruby, i get :
From jruby : -classpath =
/opt/jruby/lib/bsf.jar:/opt/jruby/lib/jruby.jar:/opt/jruby/lib/profile.j
ar:.:/opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/jdbc-sqlite3-3.5.8/lib/sqli
te-3.5.8.jar:/opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/jdbc-mysql-5.0.4/li
b/mysql-connector-java-5.0.4-bin.jar
seems OK
but with :
require ‘java’
require ‘rubygems’
require ‘jdbc/sqlite3’
module JavaLang
include_package “java.lang”
end
module JavaSql
include_package ‘java.sql’
end
puts “ENV[‘CLASSPATH’] = #{ENV[‘CLASSPATH’]}”
begin
JavaLang::Class.forName(“org.sqlite.JDBC”).newInstance
[…]
rescue JavaLang::ClassNotFoundException
puts “ClassNotFoundException”
rescue JavaSql::SQLException
puts “SQLException”
end
i get allways “ClassNotFoundException”
I’ve even verified (jar tf /path/to/file.jar) the Class
“org.sqlite.JDBC” is in.
also reading “sqlite3.rb” gives :
$ cat
/opt/jruby-1.1.3/lib/ruby/gems/1.8/gems/jdbc-sqlite3-3.5.8/lib/jdbc/sqli
te3.rb
module Jdbc
module SQLite3
VERSION = “3.5.8”
end
end
if RUBY_PLATFORM =~ /java/
require “sqlite-#{Jdbc::SQLite3::VERSION}.jar”
else
warn “jdbc-SQLite3 is only for use with JRuby”
end%
is the latest require “sqlite-#{Jdbc::SQLite3::VERSION}.jar” usefull ?
it seems, to me, it has no effect…