如何从Firefox获取书签 [英] How to get bookmarks from firefox

查看:89
本文介绍了如何从Firefox获取书签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用java从firefox获取书签.我想要一些示例代码来获取书签并将其存储到数据库中.

How to get bookmarks from firefox using java.I want some sample code for getting bookmarks and store them into database.

推荐答案

Firefox将书签保存在SQLLite中从您开始的DB操作系统将需要一个 JDBC驱动程序 [
Firefox holds the bookmarks in a SQLLite DB os to start with you''ll need a JDBC driver[^]

Here''s an example I found:
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();
    }
}


这篇关于如何从Firefox获取书签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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