Is possible to use the "shared cache" of sqlite3 through activerecord? (see: http://www.sqlite.org/inmemorydb.html)
I use activerecord standalone (without rails) in a JRuby Swing App, with some Worker-Threads involved. Problem: ONLY the main thread can access the data, since every thread rebuilds a new in-memory DB. So i get just
[SQLITE_ERROR] SQL error or missing database (no such table: insert_model_name)
from everywhere, except the main thread. Is there a workaround or did I miss something? (i use the latest versions of jruby, java, and the gems)
Thanks in advance!
Database-Config so far: https://gist.github.com/4482423
UPDATE: Minimal script to illustrate the problem. It runs well under Linux but not in WIndows 7: https://gist.github.com/4483617
ActiveRecord makes accessing your database easy, but it can also help make it faster by its intelligent use of caching.
Active Record is the M in MVC - the model - which is the layer of the system responsible for representing business data and logic. Active Record facilitates the creation and use of business objects whose data requires persistent storage to a database.
ActiveRecord::Base indicates that the ActiveRecord class or module has a static inner class called Base that you're extending.
ActiveRecord is an ORM. It's a layer of Ruby code that runs between your database and your logic code. When you need to make changes to the database, you'll write Ruby code, and then run "migrations" which makes the actual changes to the database.
The following token works well:"file::memory:?cache=shared"
Also, check your SQLite version, it should be at least 3.7.13 to support this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With