Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to get bookmarks from firefox using java.I want some sample code for getting bookmarks and store them into database.
Posted

1 solution

Firefox holds the bookmarks in a SQLLite DB os to start with you'll need a JDBC driver[^]

Here's an example I found:
Java
import java.sql.*;

public class firefoxBookmarksReader {
    public static void main(String[] args) throws Exception {
        Class.forName("org.sqlite.JDBC");
        // replace the path appropriately depending on the location of places.sqlite
        Connection conn = DriverManager.getConnection(
                "jdbc:sqlite:/home/deepak/.mozilla/firefox/yvf7p20d.default/places.sqlite//");
        if(conn==null)
        {
            System.out.println("ERROR");
        }
        System.out.println(conn.toString());

        Statement stat = conn.createStatement();

        ResultSet rs = stat.executeQuery("select * from moz_bookmarks;");
        while (rs.next()) {
            System.out.println("id = " + rs.getString("id"));
            System.out.println("keyword = " + rs.getString("keyword_id"));
            System.out.println("title = " + rs.getString("title"));
        }
        rs.close();
        conn.close();
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900