Sqlite and Netbeans 09 Jan 2009
For a project I’m working on we are using Netbeans as the primary IDE and decided to use sqlite for some temporary queue data storage. Netbeans comes equiped with a database plugin but a connector (driver) for sqlite is not provided. Here is quick way to install a driver for sqlite and view/modify your sqlite database from Netbeans 6.5.
Installing the Sqlite driver
A Java driver for Sqlite can be found at:
http://www.zentus.com/sqlitejdbc/index.html
If you want to use the latest version you can also check out their git repository:
http://git.hcoop.net/?p=crawshaw/sqlitejdbc.git
Download the jar file and place it in a somewhere you can access it (your home folder for example). Open your Netbeans and go to the “Services” window. If the window is not visible it can be accessed through the “Window” menu on the top.
In the Services window right-click the “Drivers” folder under “Databases” and choose “New driver …” from the menu. In the popup window press the “Add” button and go to the location of your downloaded jar and open it. To complete the driver field press the “Find” button. I should display the correct driver class: “org.sqlite.JDBC”.
Finally give the driver a name of your choice (e.g. Sqlite JDBC Driver) and press “OK”. The driver is now installed and can be used to connect to an Sqlite database.
Adding an Sqlite connection
In the Services window right-click the Databases entry and choose “New connection …”.
In the “New Database Connection” window that pops up choose the
Sqlite driver we installed previously (by the name you gave it). If your
database does not have a user name and password you can leave these fields
empty. In the “JDBC Url” field enter the JDBC connection string
to your sqlite file. This url looks something like this:
jdbc:sqlite:/path/to/your/database.sql
If the JDBC Url is correct a new connection is created in the Services menu, under the Databases entry. You can now connect to your database and browse or modify it.
Comments
blog comments powered by Disqus