密码保护 SQLite 数据库.是否可以? [英] Password Protect a SQLite DB. Is it possible?

查看:49
本文介绍了密码保护 SQLite 数据库.是否可以?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须面对一个新的小项目.它将有大约 7 或 9 个表,其中最大的表将以每月 1000 行的最大速度增长.

I have to face a new little project. It will have about 7 or 9 tables, the biggest of them will grow by a max rate of 1000 rows a month.

我认为 SQLite 作为我的数据库...但我需要保护数据库以防有人想更改数据库中的数据

I thought about SQLite as my db... But i will need to protect the db in case anybody wants to change data from the db

我的主要问题是:

是否可以像访问时一样使用密码保护 sqlite 数据库?

Is it possible password protect a sqlite db as you would do on access?

对于这么小的解决方案,您会推荐哪些其他 RDBMS?

What other RDBMS would you recommend for such a small solution?

开发将在 C# 上进行,但我正在寻找免费的东西.

The development would be on C#, but i'm searching something free.

推荐答案

您可以用密码保护 SQLite3 DB.在进行任何操作之前,请按如下设置密码.

You can password protect a SQLite3 DB. Before doing any operations, set the password as follows.

SQLiteConnection conn = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;");
conn.SetPassword("password");
conn.Open();

那么下次你可以像这样访问它

then next time you can access it like

conn = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;Password=password;");
conn.Open();

这将不允许任何 GUI 编辑器查看您的数据.如果您提供密码,一些编辑器可以解密数据库.使用的算法是RSA.

This wont allow any GUI editor to view your data. Some editors can decrypt the DB if you provide the password. The algorithm used is RSA.

稍后如果您想更改密码,请使用

Later if you wish to change the password, use

conn.ChangePassword("new_password");

要重置或删除密码,请使用

To reset or remove password, use

conn.ChangePassword(String.Empty);

这篇关于密码保护 SQLite 数据库.是否可以?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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