*Rafael,*

*ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 
> 'file:memdb1?mode=memory&cache=shared', pool: 10)*


- This will create a file named *file:memdb1?mode=memory&cache=shared* instead 
of in-memory DB.



On Saturday, April 11, 2015 at 4:39:25 PM UTC+5:30, Rafael Sales wrote:
>
> Mike,
>
> This will probably give what you want:
>
> *        ActiveRecord::Base.establish_connection(adapter: 'sqlite3', 
> database: 'file:memdb1?mode=memory&cache=shared', pool: 10)*
>
> Reference: https://www.sqlite.org/inmemorydb.html
>
> Notice that your SQLite must have been compiled with either THREADSAFE=1 
> or THREADSAFE=2 - more information on 
> https://www.sqlite.org/compile.html#threadsafe
>
> I've just published a post showing how you can check the THREADSAFE level 
> on SQLite: http://theheartbit.com/.../sqlite-thread-safe-check/ 
> <http://theheartbit.com/ruby/sqlite/threadsafe/concurrency/2015/04/11/sqlite-thread-safe-check/>
>
> Em sexta-feira, 5 de dezembro de 2014 01:21:23 UTC-3, Mike Anderson 
> escreveu:
>>
>> I'm trying to use a :memory: sqlite3 database that is shared amongst 
>> threads. (I'm using rails activerecord). As it is now, it seems that 
>> whenever a new connection is created, it refers to a new database. Any 
>> tips? 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlite3-ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to