Bug 207002 - Add Support for SQLite
Summary: Add Support for SQLite
Status: RESOLVED FIXED
Alias: None
Product: Data Tools
Classification: Tools
Component: Enablement (show other bugs)
Version: 1.5.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: Galileo   Edit
Assignee: Brian Fitzpatrick CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2007-10-21 08:41 EDT by Eden Klein CLA
Modified: 2008-12-04 14:02 EST (History)
3 users (show)

See Also:
bfitzpat: iplog+


Attachments
Initial contribution of sqlite profile (55.85 KB, application/octet-stream)
2008-11-13 11:40 EST, Brian Fitzpatrick CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eden Klein CLA 2007-10-21 08:41:01 EDT
Today it is impossible to see the contents of SQLite databases.
Even after overcoming the out of memory exception (see http://groups.google.com/group/sqlitejdbc/browse_thread/thread/d6dee625078d0f9b)
it is impossible to edit/view the tables.
Comment 1 Michael Kenny CLA 2008-05-15 08:28:09 EDT
These are my experiences connect to sqlite3 db.

The page http://wiki.eclipse.org/index.php/Connecting_to_SQLite
shows how to connect. However my attempts below did not quite end in success

Loading the latest drivers from http://www.ch-werner.de/javasqlite/
as mentioned allows you to Connect to the sqlite db.
And you can navigate the db Schemas, Tables etc. in the Data Source Explorer.
But if you attempt to sample a table's contents the following errors occur:

------------
!ENTRY org.eclipse.datatools.sqltools.data.ui 4 0 2008-05-15 13:43:31.375
!MESSAGE not supported
!STACK 0
java.sql.SQLException: not supported
	at SQLite.JDBC2x.JDBCStatement.setMaxRows(JDBCStatement.java:33)
	at org.eclipse.datatools.sqltools.data.internal.core.editor.TableDataImpl.<init>(TableDataImpl.java:102)
	at org.eclipse.datatools.sqltools.data.internal.ui.editor.TableDataEditor.createPartControl(TableDataEditor.java:102)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:426)
------------

This is followed by:
------------
!ENTRY org.eclipse.ui 4 0 2008-05-15 13:43:36.109
!MESSAGE Unable to create editor ID org.eclipse.datatools.sqltools.data.internal.ui.editor.tableDataEditor: An unexpected exception was thrown.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.datatools.sqltools.data.internal.ui.editor.TableDataTableCursor.registerCellEditorsListener(TableDataTableCursor.java:108)
	at org.eclipse.datatools.sqltools.data.internal.ui.editor.TableDataTableCursor.<init>(TableDataTableCursor.java:39)
	at org.eclipse.datatools.sqltools.data.internal.ui.editor.TableDataTableCursorExternalEditingSupport.<init>(TableDataTableCursorExternalEditingSupport.java:46)
	at org.eclipse.datatools.sqltools.data.internal.ui.editor.TableDataEditor.createPartControl(TableDataEditor.java:116)
------------

The query generated is:

Starting run
SELECT * FROM ""."ticket"
java.sql.SQLException: not supported

This query does also fail if you enter it in the sqlite3.exe:
sqlite> SELECT * FROM ""."ticket"
   ...> ;
SQL error: no such table: .ticket
sqlite>

I notice that the db version detected is very low 2.something rather that 3.something (in fact SQLite 2.8.17) and Version is 1
(seen by clicking on "properties/version" for the db). This is maybe a fault in the sqlite driver program?.

I tried the older version of the sqlite driver explicitly linked to (link 2) on the http://wiki.eclipse.org/index.php/Connecting_to_SQLite page but could not connect.

So am I missing something simple or is this "how to connect" page outdated?
Comment 2 Michael Kenny CLA 2008-05-15 10:20:57 EDT
I also spent a SMALL amount of time with sqlitejdbc (http://www.zentus.com/sqlitejdbc/)

With Nested (Pure Java)I get no error messages, but can only navigate to Schemas and no further.

With Native I get:
(could be Java library path problem):
----------------------------------------
!ENTRY org.eclipse.datatools.connectivity 4 -1 2008-05-15 15:52:36.828
!MESSAGE Could not connect to trac via native sqlitejdbc.
!SUBENTRY 1 org.eclipse.datatools.connectivity 4 -1 2008-05-15 15:52:36.828
!MESSAGE Error creating SQL Model Connection connection to trac via native sqlitejdbc. (Error: org/ibex/nestedvm/Runtime$CallJavaCB)
!STACK 0
java.lang.NoClassDefFoundError: org/ibex/nestedvm/Runtime$CallJavaCB
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.sqlite.Conn.<init>(Conn.java:72)
	at org.sqlite.JDBC.connect(JDBC.java:53)
	at org.eclipse.datatools.connectivity.db.generic.JDBCConnection.createConnection(JDBCConnection.java:87)
	at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:104)
	at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53)
	at org.eclipse.datatools.connectivity.db.generic.JDBCConnectionFactory.createConnection(JDBCConnectionFactory.java:52)
	at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:77)
	at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:354)
	at org.eclipse.datatools.connectivity.sqm.internal.core.connection.ConnectionInfoImpl.initializeJDBCConnection(ConnectionInfoImpl.java:658)
	at org.eclipse.datatools.connectivity.sqm.internal.core.connection.ConnectionInfoImpl.<init>(ConnectionInfoImpl.java:643)
	at org.eclipse.datatools.connectivity.sqm.internal.core.connection.ConnectionFactory.createConnection(ConnectionFactory.java:38)
	at org.eclipse.datatools.connectivity.sqm.core.SQMConnectionFactory.createConnection(SQMConnectionFactory.java:45)
	at org.eclipse.datatools.connectivity.sqm.internal.core.connection.ConnectionFactory.createConnection(ConnectionFactory.java:59)
	at org.eclipse.datatools.connectivity.internal.ConnectionFactoryAdapterProvider.createConnection(ConnectionFactoryAdapterProvider.java:112)
	at org.eclipse.datatools.connectivity.internal.ManagedConnection.createConnection(ManagedConnection.java:163)
	at org.eclipse.datatools.connectivity.internal.CreateConnectionJob.run(CreateConnectionJob.java:56)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.ClassNotFoundException: org.ibex.nestedvm.Runtime$CallJavaCB
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
----------------------------------------


Followed by:
----------------------------------------
!SUBENTRY 1 org.eclipse.datatools.connectivity 4 -1 2008-05-15 15:52:36.828
!MESSAGE Error creating JDBC Connection connection to trac via native sqlitejdbc. (Error: org/ibex/nestedvm/Runtime$CallJavaCB)
!STACK 0
java.lang.NoClassDefFoundError: org/ibex/nestedvm/Runtime$CallJavaCB
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
<snip>

This problem is also mentioned at:
http://groups.google.com/group/sqlitejdbc/browse_thread/thread/fcf581626d09c940/a75019e8f1662d62?lnk=gst&q=dtp#a75019e8f1662d62
Comment 3 Brian Fitzpatrick CLA 2008-08-11 17:44:38 EDT
I'm working on adding SQLite support in Galileo. Already have some of it working, but won't be ready to deliver it to CVS for a while. 

However, you can check out my blog (http://fitzdtp.blogspot.com/) for my SQLite progress. So far I'm able to connect in the DSE and show a list of tables (SQLite doesn't support catalogs or schemas, so there's some funky things to get around it), but all of that code will eventually make it into the DTP Enablement project.
Comment 4 Brian Fitzpatrick CLA 2008-11-13 11:40:45 EST
Created attachment 117796 [details]
Initial contribution of sqlite profile

This is an initial contribution of a new database connection profile for SQLite.
Comment 5 Brian Fitzpatrick CLA 2008-11-17 10:44:23 EST
Hey Roy... I haven't yet started the IP process for this contribution and it's still not 100% right (ran into an issue with Indices the other day), but it'll at least get us going the right direction. I'm going to talk about it a little at ESE if you're going to be there.
Comment 6 Roy Ganor CLA 2008-11-19 07:20:59 EST
These are great news. I won't be there this time but I am looking forward discussing what I can do to help (even if it is only QA)  

Comment 7 Brian Fitzpatrick CLA 2008-11-19 09:19:16 EST
(In reply to comment #6)
> These are great news. I won't be there this time but I am looking forward
> discussing what I can do to help (even if it is only QA)  

QA would be very helpful! Hopefully we can get it through the IP process first thing in December and you'll have time to bang on it. I know I didn't hit everything, but as I find bugs, I've been trying to patch them.

Thanks Roy!
Comment 8 Brian Fitzpatrick CLA 2008-12-02 14:02:37 EST
Submitted to IPZilla for review: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=2869
Comment 9 Brian Fitzpatrick CLA 2008-12-02 16:38:45 EST
Code committed to CVS. Will ask our build folks to work this into the Galileo build as soon as possible.

Roy, can you test this once we get it into the build?
Comment 10 Brian Fitzpatrick CLA 2008-12-02 16:39:35 EST
(In reply to comment #8)
> Submitted to IPZilla for review:
> https://dev.eclipse.org/ipzilla/show_bug.cgi?id=2869

IP review not required because this was done by an existing committer with the approval of the PMC
Comment 11 Roy Ganor CLA 2008-12-03 02:13:28 EST
sure, once we'll have a build...

BTW - I guess you considered adding this support to 1.6.2, can you share your thoughts about it? if this addition passes test/qa then it is stable enough to get into 1.6.2 ...

Comment 12 Brian Fitzpatrick CLA 2008-12-03 09:14:57 EST
Unfortunately we can't add it to 1.6.2. It's new functionality, a new feature, which means it falls well outside the maintenance release guidelines from Eclipse. 

Now, that said, you could take the version built for DTP 1.7 once it's available (it's only 3 plug-ins) and copy it into a 1.6.2 environment to see how things worked. It was all developed on the 1.6.2 codebase. The only thing that would be different would be that it is built on JDK 1.4 for 1.6.2 and JDK 1.5 for 1.7.
Comment 13 Brian Fitzpatrick CLA 2008-12-04 14:02:44 EST
Setting IPLog flag