无法访问SQLite数据库(火狐)使用System.Data.Sqlite火狐、无法访问、数据库、SQLite

2023-09-03 05:29:33 作者:开岸。

我写了一个小的C#/。应用网络,能够读取的Firefox cookies.sqlite文件。自从我升级到Firefox 4我的应用程序无法打开数据库文件:

I wrote a small C#/.Net application that is able to read the cookies.sqlite file of Firefox. Since I upgraded to Firefox 4 my application is not able to open the database file:

执行行connection.Open(); (在code下面的示例中)将会有一个execption,上面写着:

Executing the line "connection.Open();" (in the code sample below) there will be an execption that says:

打开的文件不是数据库文件。文件加密或不是一个数据库

"File opened that is not a database file. file is encrypted or is not a database"

这是我的程序code:

This is my program code:

class Program
{
    static void Main()
    {

        const string PATH_TO_DATABASE = @"C:\Users\Boris\Desktop\TEMP\cookies.sqlite";
        const string CONNECTION_STRING = @"Data Source=" + PATH_TO_DATABASE;

        if (!File.Exists(PATH_TO_DATABASE)) return;

        using (SQLiteConnection connection = new SQLiteConnection(CONNECTION_STRING))
        {
            connection.Open();
            using (SQLiteCommand command = new SQLiteCommand("SELECT id, name, host, path FROM moz_cookies", connection))
            {
                using (SQLiteDataReader read = command.ExecuteReader())
                {
                    while (read.Read())
                    {
                        string id = read[0].ToString();
                        string name = read[1].ToString();
                        string host = read[2].ToString();
                        string path = read[3].ToString();
                        Console.WriteLine("ID: " + id);
                        Console.WriteLine("Name: " + name);
                        Console.WriteLine("Host: " + host);
                        Console.WriteLine("Path: " + path);
                    }
                }
            }
        }
    }
}

我现在用的是NET包装DLL SQLite的诉3.6.23.1。 该应用程序的目标框架NET 2.0。

I am using the .Net Wrapper DLL for Sqlite v. 3.6.23.1. The target framework of the application is .Net 2.0.

我可以不使用所谓的SqliteExpert的应用程序的任何问题打开SQLite数据库。

I was able to open the sqlite database without any problems using an application called SqliteExpert.

这将是巨大的,如果任何人有一个想法!

It would be great if anybody has an idea!

问候, 鲍里斯

推荐答案

您好,非常感谢您的回答!

Hello and thanks alot for your answers!

我在我的应用程序的工作是这样的:

I made my application work this way:

1。 我下载了当前ADO.NET连接器的来源.NET 4.0的位置: http://system.data.sqlite.org/index.html/timeline?r=trunk

1. I downloaded the sources of the current ADO.NET Connector for .NET 4.0 here: http://system.data.sqlite.org/index.html/timeline?r=trunk

也许你会必须首先使用匿名用户名和CAPCHA作为passoword在网站上登录。

Maybe you will have to logon on the website first using a anonymous user name and a capcha as passoword.

2。 我得到了$ P $通过下载安装此ADO.NET接口pcompiled版sqlite3.dll v.3.7.4的:的 http://www.devart.com/dotconnect/sqlite/ (您可以使用ADO.NET连接库作为替代连接器从system.data.sqlite.org为好。 我自己只关心sqlite3.dll。)

2. I obtained the precompiled version of the sqlite3.dll v.3.7.4 by downloading an installing this ADO.NET connector: http://www.devart.com/dotconnect/sqlite/ (You may use the ADO.NET connector libs as an replacement for connector from system.data.sqlite.org as well. I myself am only interested in the sqlite3.dll.)

3。 从system.data.sqlite.org编译源代码后,我复制产生System.Data.Sqlite.dll和sqlite3.dll我的应用程序的输出目录。请注意,这两个DLL文件被编译无论是x86或x64机器。

3. After compiling the sources from system.data.sqlite.org I copied the resulting System.Data.Sqlite.dll and the sqlite3.dll to my applications output directory. Please note that both DLLs are compiled either for x86 or x64 machines.

问候