[转]SQLite数据库连接方式

简介:

http://blog.csdn.net/ZF101201/archive/2010/05/26/5626365.aspx

 

SQLite.NET

Type:    .NET Framework Class Library

Usage:  System.Data.SQLite.SQLiteConnection

Basic

Data Source=filename;Version=3;

Version 2 is not supported by this class library.

 Using UTF16

Data Source=filename;Version=3;UseUTF16Encoding=True;

 With password

Data Source=filename;Version=3;Password=myPassword;

 Using the pre 3.3x database format

Data Source=filename;Version=3;Legacy Format=True;

 With connection pooling

Connection pooling is not enabled by default. Use the following parameters to control the connection pooling mechanism.

Data Source=filename;Version=3;Pooling=False;Max Pool Size=100;

 Read only connection

Data Source=filename;Version=3;Read Only=True;

 

Using DateTime.Ticks as datetime format

Data Source=filename;Version=3;DateTimeFormat=Ticks;

The default value is ISO8601 which activates the use of the ISO8601 datetime format

 

Store GUID as text

Normally, GUIDs are stored in a binary format. Use this connection string to store GUIDs as text.

Data Source=filename;Version=3;BinaryGUID=False;

Note that storing GUIDs as text uses more space in the database.

 

Specify cache size

Data Source=filename;Version=3;Cache Size=2000;

The Cache Size value measured in bytes

 

Specify page size

Data Source=filename;Version=3;Page Size=1024;

The Page Size value measured in bytes

 

Disable enlistment in distributed transactions

Data Source=filename;Version=3;Enlist=N;

 

 Disable enlistment in distributed transactions

Data Source=filename;Version=3;Enlist=N;

 

Disable create database behaviour

If the database file doesn't exist, the default behaviour is to create a new file. Use the following parameter to raise an error instead of creating a new database file.

Data Source=filename;Version=3;FailIfMissing=True;

  Limit the size of database

Data Source=filename;Version=3;Max Page Count=5000;

The Max Page Count is measured in pages. This parameter limits the maximum number of pages of the database.

 

Disable the Journal File

This one disables the rollback journal entirely.

Data Source=filename;Version=3;Journal Mode=Off;

 

Persist the Journal File

This one blanks and leaves the journal file on disk after a commit. Default behaviour is to delete the Journal File after each commit.

Data Source=filename;Version=3;Journal Mode=Persist;

 

 Controling file flushing

Data Source=filename;Version=3;Synchronous=Full;

Full specifies a full flush to take action after each write. Normal is the default value. Off means that the underlying OS flushes I/O's.

2.Finisar.SQLite ADO.NET Data Provider

Standard

Data Source=mydb.db;Version=3;

The "Version" key can take value "2" for SQLite 2.x (default) or value "3" for SQLite 3.x

 Create a new database

Data Source=mydb.db;Version=3;New=True;

  Using compression

Data Source=mydb.db;Version=3;Compress=True;

 Specifying Cache Size

The Cache Size value represents the amount of data pages that are held in memory. Try increase this value for speed improvements but don't forget to keep track of the applications memory usage.

Data Source=mydb.db;Version=3;Cache Size=3000;

 

3.SQLite3 ODBC Driver

Standard

DRIVER=SQLite3 ODBC Driver;Database=mydb.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;

 

.NET Framework Data Provider for ODBC

Bridging to SQLite3 ODBC Driver

This is just one connection string sample for the wrapping OdbcConnection class that calls the underlying ODBC Driver. See respective ODBC driver for more connection strings to use with this class.

DRIVER=SQLite3 ODBC Driver;Database=mydb.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;

 


本文转自火地晋博客园博客,原文链接:http://www.cnblogs.com/yelaiju/archive/2010/10/21/1857887.html,如需转载请自行联系原作者

目录
相关文章
|
存储 物联网 网络性能优化
|
10月前
|
前端开发 API UED
React 懒加载图片 Lazy Image
懒加载是一种优化技术,通过延迟加载不在视口内的图片,减少初始页面加载时间,提升用户体验。本文从基础概念入手,逐步探讨 React 中实现图片懒加载的常见问题、易错点及解决方案,并通过代码案例详细解释。
389 3
|
1月前
|
人工智能 算法 安全
算法备案新手攻略——2025全网最新最详细解读版
本文介绍了算法备案的背景、法规依据、备案类型及流程,涵盖生成合成、个性化推送等五大算法类型,并详细说明所需材料与备案周期,强调未备案将面临行政处罚甚至刑事追责,助力企业合规运营。
|
弹性计算 数据库
阿里云服务器流量怎么计算的?公网内网出入流量都收费吗?
阿里云服务器内网流量免费,公网入方向流量免费,只有云服务器公网出方向产生的流量才收费
7745 0
阿里云服务器流量怎么计算的?公网内网出入流量都收费吗?
|
自然语言处理 小程序
ModelScope体验:自然语言推理模型应用
自然语言推理,即输入形如(前提句,假设句)的句子对数据,模型会给出该句子对应的自然语言推理标签(contradiction、entailment、neutral)以及相应的概率,从而反映出句子对之间的关系。本文以“达摩自然语言推理”模型为例,展示了如果调用ModelScope工具,并通过gradio将该功能部署为小程序的过程。
|
数据采集 机器学习/深度学习 数据挖掘
Python基于波动率模型(ARCH和GARCH)进行股票数据分析项目实战
Python基于波动率模型(ARCH和GARCH)进行股票数据分析项目实战
|
SQL 关系型数据库 MySQL
Navicat使用HTTP通道连接MySQL(远程mysql3306端口关闭或者只允许localhost链接状态)...
Navicat使用HTTP通道连接MySQL(远程mysql3306端口关闭或者只允许localhost链接状态)...
6189 0
Navicat使用HTTP通道连接MySQL(远程mysql3306端口关闭或者只允许localhost链接状态)...
|
分布式计算 Spark 大数据
Apache Spark中国技术交流社区历次直播回顾(持续更新)
Apache Spark中国技术交流社区,由阿里巴巴开源大数据技术团队成立,持续输出spark相关技术直播、原创文章、精品翻译,钉钉群内千人交流学习,欢迎加入。钉钉入群 https://qr.dingtalk.com/action/joingroup?code=v1,k1,jmHATP9Tk+okK7QZ5sw2oWSNLhkt2lCRvfHRdW7XhUQ=&_dt_no_comment=1&origin=11 更多视频和ppt资料请入群获得。
Apache Spark中国技术交流社区历次直播回顾(持续更新)
|
运维 网络安全 Docker
docker报错ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule
docker报错ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule
1029 0
|
机器学习/深度学习 决策智能
双边滤波方法原理与代码实践(附完整代码)
双边滤波方法原理与代码实践(附完整代码)
1397 0