[jruby-user] JRuby and Sqlite3

"Roderich T." <[email protected]> Sat, 28 Feb 2015 16:05:51 +0100
Newsgroups gmane.comp.lang.jruby.user
Message-ID <[email protected]>
Hi,
I want to compile my ruby application into a jar File.

Now there I get a strange error using jdbc/sqlite3.

This is my ruby (test) code:

require 'rubygems'
require 'jdbc/sqlite3'
require 'java'

import org.sqlite.JDBC

connection = java.sql.DriverManager.getConnection
'jdbc:sqlite:test.sqlite3'
begin
  statement = connection.createStatement
  begin
    statement.executeUpdate("insert into user values ('test', 7)")
    rs = statement.executeQuery("select * from user")
    begin
      puts "user\tpass"
      while rs.next
        puts ["#{rs.getString(1)}",
              "#{rs.getString(2)}"].join("\t")
      end
    ensure
      rs.close
    end
  ensure
    statement.close
  end
ensure
  connection.close
end

There are no problems using jruby directly, but when I include the
script in jruby-complete.jar using "jar ufe myapp.jar
org.jruby.JarBootstrapMain jar-bootstrap.rb", I always get an error when
I start it ( java -jar myapp.jar ):

NameError: missing class or uppercase package name (`org.sqlite.JDBC')

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email