SQLite:如何连接到内存中的共享缓存数据库? [英] SQLite: How do I connect to an in-memory, shared cache database?

查看:796
本文介绍了SQLite:如何连接到内存中的共享缓存数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过ADO.NET提供程序试用SQLite 3.7.13的内存中共享缓存功能。
以下连接字符串有效,但会产生非共享缓存的数据库:

I'm trying out the in-memory shared cache feature of SQLite 3.7.13, via the ADO.NET provider. The following connect string works, but yields a non-shared-cache db:

Data Source=:memory:

当我尝试以下任一操作时:

When I try any of these:

Data Source=:memory:?cache=shared
Data Source=file::memory:?cache=shared
Data Source=file:x?mode=memory&cache=shared

我得到以下 ArgumentException 打开连接时:

I get the following ArgumentException when opening a connection:

Invalid ConnectionString format for parameter "Data Source"

SQLite内存共享缓存数据库的连接字符串应该是什么样?

What should the connect string look like for SQLite in-memory shared-cache databases?

推荐答案

尽管共享缓存功能位于SQLite中,但看起来最新版本(1.0.81.0)的System.Data.SQLite当时尚不支持FullUri功能。看起来好像是1.0.82.0版本的作品,连接字符串应该是:

It looks like although the shared cache feature was in SQLite, the latest (1.0.81.0) version of System.Data.SQLite at the time didn't yet support the FullUri feature. Looks like the 1.0.82.0 version works, and the connection string should be:

FullUri=file::memory:?cache=shared

这篇关于SQLite:如何连接到内存中的共享缓存数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆