打开Firefox的文件'places.sqlite“使用PowerShell和System.Data.SQLite [英] Opening Firefox file 'places.sqlite' with PowerShell and System.Data.SQLite

查看:599
本文介绍了打开Firefox的文件'places.sqlite“使用PowerShell和System.Data.SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要运行以下code:

I want to run the following code:

$dll = [System.Reflection.Assembly]::LoadWithPartialName("System.Data.SQLite")
# [System.Reflection.Assembly]::LoadFrom("C:\Program Files\System.Data.SQLite\bin\System.Data.SQLite.dll")

$ConnectionString = "Data Source=C:\Var\sqlite_ff4\places.sqlite"

$conn = New-Object System.Data.SQLite.SQLiteConnection
$conn.ConnectionString = $ConnectionString
$conn.Open()
$sql = "SELECT * from moz_bookmarks"
$cmd = New-Object System.Data.SQLite.SQLiteCommand($sql, $conn)

#    $cmd.CommandTimeout = $timeout

$ds = New-Object system.Data.DataSet
$da = New-Object System.Data.SQLite.SQLiteDataAdapter($cmd)
$da.fill($ds)

$conn.close()

$ds.tables[0]

目前该行

$conn.Open()

我得到的错误

I get the error

Exception calling "Open" with "0" argument(s): "File opened that is not a database file
file is encrypted or is not a database"
At line:5 char:11
+ $conn.Open <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

文件 places.sqlite 是从Firefox 4.0。我使用 http://sourceforge.net/projects/sqlite-dotnet2/files/

The file places.sqlite is from Firefox 4.0. I'm using http://sourceforge.net/projects/sqlite-dotnet2/files/.

编辑:

有关火狐3.0的文件上面的作品 places.sqlite 。事情似乎不同与Firefox 4.0。

The above works for the Firefox 3.0 file places.sqlite. Something seems to be different with Firefox 4.0.

这似乎不是一个密码的问题,而是一个版本的问题。由于这个堆栈&NBSP;溢出后我发现,我需要的SQLite 3.7。

It doesn't seem to be a password problem, but a version problem. Thanks to this Stack Overflow post I found, that I need SQLite 3.7.

我希望我找到了一些当前的ADO提供商。

I hope I find some current ADO provider.

的sqlite-DOTNET-x86-1006900.exe从这里不能正常工作

sqlite-dotnet-x86-1006900.exe from here doesn't work

异常调用打开和0的说法(S):无法加载DLLSQLite.Inte rop.DLL:指定的模块找不到。 (从HRESULT异常:0x8中 007007E)

Exception calling "Open" with "0" argument(s): "Unable to load DLL 'SQLite.Inte rop.DLL': The specified module could not be found. (Exception from HRESULT: 0x8 007007E)"

这可能是一个调试版本。是否有任何prebuild版本没有SQLite.Interop.DLL?

It is possibly a debug build. Are there any prebuild version without an SQLite.Interop.DLL?

推荐答案

终于解决(由工作GAC不安装大约):

要打开火狐4.0 places.sqlite必须使用3.7版或上从sqlite的。

To open Firefox 4.0 places.sqlite you must use a version 3.7 or upper from sqlite.

从我的此处,但没有不会查看安装在GAC复选框。安装在GAC仍然是错误的。

I installed sqlite-dotnet-x86-1007000.exe from here, but did not check the install in GAC checkbox. Install in GAC is still faulty.

现在下面的PowerShell code能正常工作places.sqlite复印件(请记住,你不能打开它,而锁定火狐):

Now the following PowerShell Code works fine on a copy of places.sqlite (remember you can't open it while locked by Firefox):

# adapt these two lines to your loacal system
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\System.Data.SQLite\bin\System.Data.SQLite.dll") 
$ConnectionString = "Data Source=C:\Var\sqlite_ff4\places.sqlite"

$conn=new-object System.Data.SQLite.SQLiteConnection 
$conn.ConnectionString=$ConnectionString 
$conn.Open() 
$sql = "SELECT * from moz_bookmarks"
$cmd=new-object System.Data.SQLite.SQLiteCommand($sql,$conn)
$ds=New-Object system.Data.DataSet
$da=New-Object System.Data.SQLite.SQLiteDataAdapter($cmd)
$da.fill($ds) 
$conn.close()
$ds.tables[0]

由于SQLite的-DOTNET-x86-1006900.exe他们吐唾沫SQLite.Interop.dll从System.Data.SQLite.dll,但出了问题,在GAC安装。如果您检查安装在GAC复选框,你会得到一个 无法加载DLLSQLite.Interop.DLL 错误。有一个封闭的这个错误,但我认为这是不固定的。票再重新打开。检查有新的变通或解决方案。

Since sqlite-dotnet-x86-1006900.exe they spitted SQLite.Interop.dll from System.Data.SQLite.dll, but had problems with installing it in GAC. If you check the install in GAC checkbox, you get an Unable to load DLL 'SQLite.Interop.DLL error. There is a closed ticket for this error, but I think it is not fixed. The ticket is reopened again. check there for new work arounds or solutions.

这篇关于打开Firefox的文件'places.sqlite“使用PowerShell和System.Data.SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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