views:

5927

answers:

3

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? :(

+1  A: 

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.

Doug Currie
A: 

I have download this driver and was trying to install it such as described here.

But, unfortunately, obtaining such error

Cannot establish a connection to ... using SQLite.JDBCDriver

(java.lang.NoClassDefFoundError: Could not initialize class SQLite.JDBC2x.DatabaseX)

Have I missed smth?

Thanks

Toleg
You're better off posting this as a separate question (the "Ask Question" at the upper-right corner of the page). More people are likely to see your question and answer it well if you ask a new question than if you hide a question in the answers to another question, which disregards the "question/answer" format of the site.
sth
actually I could not use SQLite with Netbeans after all. so I quit trying and start using the command line interface. :|
farzad
A: 

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 :))

Toleg