Question

I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed a JDBC SQLite driver from zentus.com and added a new driver in 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 fails to connect. I get 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? :(

Was it helpful?

Solution

The current version of Zentus SQLiteJDBC is v053, based on SQLite 3.6.1. It will not open a 2.x SQLite database. Perhaps you can use SQLite 2.x command line tool to .dump your database, and the Sqlite3 command line tool to .load it. The use Zentus SQLiteJDBC to access the new SQLite 3.x database.

Alternatively, use a JDBC driver that supports SQLite 2 such as this one.

OTHER TIPS

It's againg me...

I have made two mistakes during my first attempt. After setting CLASSPATH as a system variable (hope I didn’t broke smth else :)), putting sqlite_jni.dll to the system32 folder and correcting JDBC url I have got a success :)

I also have downloaded their SQLite ODBC wrapper. Installed it and made a connection to my SQLite2 database via ordinary and UTF8 based ODBC driver. I also used built in NetBeans JDBC-ODBC Bridge driver to be able to set up this connection.

All three connections have been created but:

  • ordinary ODBC driver: I see text data in a wrong encoding. All other columns are displayed correctly

  • UTF8 ODBC driver: I don’t see text data at all. All other columns are displayed correctly

  • JDBC driver: I don’t see any column at all. "Select * from my_any_table" always returns an empty single column

I have Russian based data in my database.

So...currently I have returned to sqlite command line interface :))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top