문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top