tags:

views:

436

answers:

2

Firefox 3 now stores bookmarks in a Sqlite file called profiles.sqlite.

This file is locked while Firefox 3 is running.

I know that there are backup files, but they are old (only written when FF exits).

I do not want the user to have to install a plug-in.

Is there a way to grab the bookmarks while FF 3 is running?

I am developing in C# 3.5 for Windows.

+2  A: 

SQL Lite is an embedded database for single user applications and isn't built for multi user access. See the section titled "Situations Where Another RDBMS May Work Better" of their When To Use question list.

Also, the text under "High Concurrency" states "SQLite uses reader/writer locks on the entire database file."

So, No there isn't another option. Build a plugin.

Chris Lively
A: 

I too got stuck with the same problem but after searching around on this site and others, came up with this code for my project http://www.codertakeout.com.

using System.Data.SQLite;  // need to install sqlite .net driver

String path_to_db = @"C:\Documents and Settings\Jeff\Application Data\Mozilla\Firefox\Profiles\yhwx4xco.default\places.sqlite";
String path_to_temp = System.IO.Path.GetTempFileName();

System.IO.File.Copy(path_to_db, path_to_temp, true);
SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + path_to_temp + ";Version=3;Compress=True;Read Only=True;");

SQLiteCommand sqlite_command = sqlite_connection.CreateCommand();

sqlite_connection.Open();

sqlite_command.CommandText = "SELECT moz_bookmarks.title,moz_places.url FROM moz_bookmarks LEFT JOIN moz_places WHERE moz_bookmarks.fk = moz_places.id AND moz_bookmarks.title != 'null' AND moz_places.url LIKE '%http%';";

SQLiteDataReader sqlite_datareader = sqlite_command.ExecuteReader();

while (sqlite_datareader.Read())
    {
        System.Console.WriteLine(sqlite_datareader[1]);
    }
sqlite_connection.Close();
System.IO.File.Delete(path_to_temp);
jeff