DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

How to initialize the SQLite3 JDBC driver in JRuby?

StackOverflow https://stackoverflow.com/questions/9351300

Question

How do you access SQLite3 via JDBC without using active record?

No correct solution

OTHER TIPS

Install the jdbc-sqlite3 gem

Then, in your jruby script:

require 'jdbc/sqlite3'
url = "jdbc:sqlite:path.to.your.db"
begin        
    Java::org.sqlite.JDBC #initialize the driver
    connection = JavaLang::DriverManager.getConnection(url) #grab your connection
rescue => error      
    #handle error
end

The jdbc driver file sqlite-3.5.8.jar gets copied into the gem directory. It needs to be copied into the jruby/lib directory. Application also needs restart.

The driver file can be downloaded directly from here

http://files.zentus.com/sqlitejdbc/sqlitejdbc-v056.jar

http://www.zentus.com/sqlitejdbc/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow