How do I make a database service in Netbeans 6.5 to connect to SQLite databases?
I am using Netbeans IDE (6.5) and I have a SQLite 2.x database. I have installed the Jite SQLite driver from zentus.com and added the new driver in the Nebeans services panel. Then tried to connect to my database file from Services> Databases using this url for my database:
JDBC: SQLite: /home/farzad/netbeans/myproject/mydb.sqlite
but it cannot connect. I am getting this exception:
org.netbeans.modules.db.dataview.meta.DBException: Unable to Connect to database : DatabaseConnection[name='jdbc:sqlite://home/farzad/netbeans/myproject/mydb.sqlite [ on session]']
at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.initialDataLoad(SQLExecutionHelper.java:103)
at org.netbeans.modules.db.dataview.output.DataView.create(DataView.java:101)
at org.netbeans.modules.db.dataview.api.DataView.create(DataView.java:71)
at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:105)
at org.netbeans.modules.db.sql.loader.SQLEditorSupport$SQLExecutor.run(SQLEditorSupport.java:480)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
What should I do?: (
source to share
The current version of Zentus SQLiteJDBC is v053, based on SQLite 3.6.1. It will not open SQLite 2.x database. Perhaps you can use the SQLite 2.x command line tool to .dump your database and the Sqlite3 command line tool to download it. Using Zentus SQLiteJDBC to Access New SQLite 3.x Database.
Alternatively, use a JDBC driver that supports SQLite 2, like this one .
source to share
I like...
I made two mistakes on my first try. After setting CLASSPATH
as a system variable (hope I didn't break smth else :)), putting sqlite_jni.dll
in a folder system32
and fixing JDBC url
, I was successful :)
I downloaded them as well SQLite ODBC wrapper
. Installed it and connected to my database SQLite2
via regular and UTF8
driver based ODBC
. I also used the built-in NetBeans JDBC-ODBC
Bridge driver to establish this connection.
All three connections are created, but:
-
ordinary ODBC driver
: I see text data in the wrong encoding. All other columns are displayed correctly. -
UTF8 ODBC driver
: I can't see text data at all. All other columns are displayed correctly. -
JDBC driver
: I can't see the speaker at all."Select * from my_any_table"
always returns an empty single column
I have Russian data in my database.
So ... I am currently back to the sqlite command line interface :))
source to share