Community
Participate
Working Groups
Build Identifier: 20100218-1602 I cannot view/edit any tables when using the SQLite JDBC Driver. The error message says: "Cannot edit table. An unknown or unsupported data type encountered for column type." When I expand the "Column" Node of a table, the data types of the columns are not shown. However, if I disconnect and reconnect to the database, the datatypes of some columns are shown correctly. After interaction with the GUI they are gone again. Reproducible: Always Steps to Reproduce: 1. Open the Database Development Perspective 2. Connect to a sqlite database with the "SQLite JDBC Driver" 3. Go to [database_name]->"Schemas"->"Default"->"Tables"->[table_name]->RMB->"Data"->"Edit" 4. The error should appear
Created attachment 177472 [details] The database where the error occures.
This is easy to reproduce... 1) Download the Zentus SQLite JDBC driver from (http://www.zentus.com/sqlitejdbc/) 2) Create a new SQLite driver definition and point to the driver 3) Create a new SQLite connection profile 4) Import the attached project into your workspace. 5) Change the JDBC URL in the Test.java class with a path pointing to where you put your database. 6) Run the class. It should create a PEOPLE database with some data. 7) Connect to the profile 8) Drill in, look for the PEOPLE database 9) Right-click and select Data->Edit I am able to sample the contents of the database - the results of which shows up fine in the Results view. But Editing throws this exception... !ENTRY org.eclipse.ui 4 0 2010-09-23 16:02:51.525 !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:124) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595) at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313) at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180) at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270) at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606) at org.eclipse.ui.internal.PartStack.add(PartStack.java:497) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103) at org.eclipse.ui.internal.PartStack.add(PartStack.java:483) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112) at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63) at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225) at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213) at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677) at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2860) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768) at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2674) at org.eclipse.datatools.sqltools.data.internal.ui.editor.EditTableDataAction.run(EditTableDataAction.java:63) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Hope that helps!
Created attachment 179492 [details] SQLite Test project Note - this project uses the driver definition to find the jar and add it to the classpath, so make sure you create the driver definition with the default name before importing it into your workbench.
Also encountering this bug. After following the same steps but choosing "Sample Contents", a clue can be found in the SQL Results view... 1) Download the Zentus SQLite JDBC driver from (http://www.zentus.com/sqlitejdbc/) 2) Create a new SQLite driver definition and point to the driver 3) Create a new SQLite connection profile 4) Import the attached project into your workspace. 5) Change the JDBC URL in the Test.java class with a path pointing to where you put your database. 6) Run the class. It should create a PEOPLE database with some data. 7) Connect to the profile 8) Drill in, look for the PEOPLE database 9) Right-click and select Data->Sample Contents Here's the error emitted to the Status tab of the SQL Results view: Starting run SELECT * FROM DEFAULT.PEOPLE java.sql.SQLException: near "DEFAULT": syntax error I believe that sqlite is using 'main' instead of 'DEFAULT' as the standard database name. This can be confirmed by executing a query in the SQL Scrapbook view: select * from main.PEOPLE; I think the DTP plug-in code causing the problem might actually be shown in Brian's blog post(?): http://fitzdtp.blogspot.com/2008/08/dtp-sqlite-support-continued-on-to.html
Wouldn't surprise me. Though it's odd that this hasn't surfaced until now. You're talking about this line: Schema schema = (Schema) getAndRemoveSQLObject(existingSchemas, "DEFAULT"); I'll look into it and see what I can do...
Ok, a couple of things here... I had to dive back into the whole loader framework a bit to figure this out. First... The whole "DEFAULT" vs. "main" discussion is irrelevant. The JDBC driver doesn't return any schemas, so we're forced to create a dummy one called "DEFAULT" to shoehorn the tables etc into the model. Second... It seems that though we "support" precision and scale in the loaders, they don't actually seem to be supported by SQLite. So we're throwing some EMF exceptions under the covers when we set those values on certain data types. So I will submit a patch to "correct" this issue. Third... I'm going to dig into the table data editor to see what I can figure out...
Ok. The issue doesn't lie in the SQL Table Editor, but instead lies with the SQLite database definition. When I initially created the definition I asked for help I never got and nobody has found anything wrong until now. :) Now, a couple of things... The recognosco.db database that's attached has a column with data type "timestamp" - this is not one of the datatypes in the http://www.sqlite.org/datatype3.html page, section 2.2. So I'm not all that comfortable with including it in the data types list. That said, I believe I have the database definition whipped back into shape now that I have a bit more understanding of how SQLite handles types. I'm going to say that because of the significant change to the SQLite database definition xmi file this will have to be pushed into 1.9 once we have a branch for the 1.9 release. However, I will attach patches for the org.eclipse.datatools.enablement.sqlite plug-in and the org.eclipse.datatools.enablement.sqlite.dbdefinition plug-ins here for you to test with if you'd like along with a screen shot of the table editor editing data from one of the tables in your sample database.
Created attachment 180503 [details] Patch for the SQLite database definition
Created attachment 180504 [details] Patch for sqlite loader to handle a couple of edge cases (BLOB mostly)
Created attachment 180505 [details] Sample of table edit Here's a screen shot editing one of your tables. It works for both. Notice in the Data Source Explorer that each data type is defaulted up to the main SQlite type it rolls up into - INTEGER, TEXT, NONE, REAL, and NUMERIC. So if you have a data type like "float" it will be shown as "REAL" which is how the database interprets it.
Now I'll start looking into Dwight's issue...
@Dwight - a couple of things... First, SQLite doesn't have the concept of a schema in it, so the "DEFAULT" you see in the Data Source Explorer is there simply to make the SQLite database model fit with the standard JDBC database model. So you don't need the "DEFAULT" in your query. Second, now that types actually work with the other patches done, you can change the line in the test project to be: stat.executeUpdate("create table people (name VARCHAR(50), occupation VARCHAR(50));"); To add types to the two columns and you can sample contents, edit the table, and do anything else you want to do.
So I'm going to hold this one until we get a 1.9 branch done in CVS and then will check these tweaks in. In the meantime, you can test the patches against what's currently in HEAD for the two plug-ins I mentioned earlier.
(In reply to comment #13) > So I'm going to hold this one until we get a 1.9 branch done in CVS and then > will check these tweaks in. In the meantime, you can test the patches against > what's currently in HEAD for the two plug-ins I mentioned earlier. Hi, I kind of expected to see this patch available in Eclipse Data Tools Platform v1.9 (http://www.eclipse.org/datatools/downloads.php) but apparently it's not there. Do you have a target release version for this patch ? TIA. Alex.
Running into this issue with the Database Explore with the Andmore project. I know it is about 4 years later. The patches would seem to address the issues.