Read Firefox 3 bookmarks - java

Firefox 3 stores the bookmarks in a sqlite database.
There are several hacked sqlite java libraries available.
Is there a way to hack the sqlite database in java(not using libraries) to read bookmarks reliably?
Does someone know how the sqlite DB is stored and access programmatically (from java)?

You need the SQLite JDBC driver (this page explains how to run queries on a SQLite database using that driver from within Java).

I don't know why you need NOT to use a JDBC driver, but there's another possible "solution" depending on your software requirements. In FF3, type in the address bar about:config
Alter the value of property: browser.bookmarks.autoExportHTML to true.
This will export your bookmarks in an HTML whenever you close FF. You can then read the HTML. It may or may not solve your problem....

Related

Creating Database in JDBC Sqlite

I am using the SQLite driver from
http://code.google.com/p/sqlite-jdbc/wiki/Introduction
Examples shown in the above doc shows how to connect an existing database.
In my application I need to create an SQLite database. How to do that? Is it sufficient to create a file with extension .db?
Also is there a function called createFile(). If so how to use it? I googled and nobody is giving a clear answer.
SQLite creates new database file on first attempt to connect if file did not exist already.
So, simply use jdbc:sqlite:filename.db as JDBC connection string, and provided that you have permission to create filename.db, it will be created automatically. You can also manually pre-create this file with 0 size if you want.

Netbeans Database Explorer and Microsoft SQL Server not getting along

I am trying to get a Java desktop application to pull some data from a Microsoft SQL-Server 2008 Database. Netbeans database explorer can generate Entity classes from database tables, but I was unable to get this feature working. Normally, when you conect to a database, you see something like this:
I entered the database URL, username and password, and the connection was established. But when I tried to explore the tables, they were all empty. Instead of the nice tree above, I was just given a list of empty Schemas. Mutlitple user names were tried, all had the same issue. Since there was no schema on the database matching the username, a number of different schemas were displayed for me to choose. Regardless of which one I chose, when I expanded it nothing showed up inside the Table, or the Views.
To verify that the useranema and password did have access to the tables I am interested in, I wrote a short Java method to connect to the database and display the ResultSet for a query. It worked as expected. Why was the netbeans database explorer unable to find the tables?
I was hoping to use this tool to generate Entity classes with Netbeans, but apparently Microsoft SQL erver won't have it. I am using netbeans 7.1; documentation for the database explorer tool is found on db.netbeans.org
Yesterday I had the same problem with JDBC driver from Microsoft. I tried another one, the project jTDS (available on SourceForge). It could solve my problem. Some forums recommend always to use this driver because it is much faster.

How to install SQLite database on the WIndows XP system

I want to connect my java program to the SQLite db. What are necessary steps that I have to follow. I want to install sqlite database on my system to access the database.
From the SQLite Homepage:
SQLite is a in-process library that implements a self-contained,
serverless, zero-configuration, transactional SQL database engine.
[...]
SQLite is an embedded SQL database engine. Unlike most other SQL
databases, SQLite does not have a separate server process. SQLite
reads and writes directly to ordinary disk files. A complete SQL
database with multiple tables, indices, triggers, and views, is
contained in a single disk file.
So you don't actually install SQLite. To create and work with SQLite Databases, you can use the provided sqlite-shell, which is a command-line tool. If you are familiar with SQL, this should not be a problem.
Although, there are also some GUI-tools out there to work with SQLite...
If you want your Java-application to access and work with an SQLite Database, you'll need the necessary drivers. A nice topic on this can be found here.
Hello mayur rahatekar,
Here's a quick tutorial for creating a sqlitedb on your computer, its explained from the ground of:
SQLiteDB with some Androidflavour
Best Regards
safari
You can take the help of mozilla firefox browser.If you have then you can search on google how to integrate sqlite with mozilla.it's very easy.Click here to see the link.

Store data between Program Runs Java

Short Version: I need to store some data between runs of a java program.The data will be of the form of a table.Is there anything that can let do something like a sql query in java??THE SOLUTION MUST BE ABLE TO RUN ON AN OFFLINE COMPUTER.
Long Version: The user will be entering some data daily and i want something like a sql table in java. The program will run on a computer that is NOT CONNECTED TO THE INTERNET and so i need a truly local way to store data(Lots of it).Also preferably the data should be stored in such a way that it is not easily accessible to the end user(as in ,he should not be able to double click the file and simply read its contents)
Major Constraint: On searching online i found many people were using localhost to solve similar problems but that facility is not available to me as i CANNOT INSTALL ANYTHING on the target computer.
If a simple data file is not good enough, how about using SQLite with a JDBC backend? It will allow you to have an SQL database stored in a regular file with no dependency on any kind of server. Alternatively, there are many other embedded DB engines that you could use, depending on your needs.
EDIT:
By the way, most (if not all) DB engines that I know of do not obfuscate the data before storing them in the filesystem. The data will be fragmented, but parts of it will be visible if you force an editor to open the file (e.g. using "Open with..." in Windows).
There is also nothing to stop your user from accessing the data using the command line utility of the selected DB engine. If you want to obfuscate the data you have to do it in your code. Keep in mind that this will not stop a determined person - if your application can read it offline, so can everyone else.
Use an embedded database (like Apache Derby, HSQLDB, H2) so that you don't have to run a database server on the machine. The data will be stored locally on the target machine and it won't be human readable.
You have several options:
Store it in an xml-file
Store it in an local installed database
You can install a database like mysql or use a in memory database like sqlite or hbase or apache derby, which is included in java 6

HSQLDB - hiding database structure/contents from users

I'm considering using HSQLDB version 1.8.x in a desktop app for storing local data. From what I can see, the database is stored on disk as a number of SQL statements to create the tables, insert the data, etc.
Is there a simple way I can hide this from users? I'm don't necessarily need it to be completely encrypted, etc - I'd just like to prevent the casual user from simply opening the file and seeing the structure of the database.
You could embed your database files within a jar file and connect to them using the notation:
jdbc:hsqldb:res:<path in jar>
Check out the Advanced Topics section of the HSQLDB guide for more information on this. However, I've never tried it so am not 100% sure it will work ...
The solution I've gone with for now is to call:
db.update("SET SCRIPTFORMAT COMPRESSED;");
to store the .script file in a human-unreadable form and:
db.update("SET PASSWORD password;");
to prevent more savvy users from opening the DB using their own HSQLDB client.
Unfortunately I was not able to execute below command
db.update("SET scriptformat COMPRESSED");
And was getting this error
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: SCRIPTFORMAT
This error solved with this command
db.update("SET FILES SCRIPT FORMAT COMPRESSED");
I am using HSQLDB 2.3.3

Categories

Resources