We're updating the issue view to help you get more done. 

Primary Key Lookup fails for Oracle tables with underscores in their name

Description

When inserting features into a table in an Oracle Datastore, if the table name contains underscores, then:
The primary key lookup will fail:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 30 Apr 13:22:25 WARN [geotools.jdbc] - Failure occurred while looking up the primary key with finder: org.geotools.jdbc.HeuristicPrimaryKeyFinder@24cf7139 java.sql.SQLException: Exhausted Resultset at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:382) at org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:213) at org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:213) at org.geotools.data.oracle.OracleDialect.getMapping(OracleDialect.java:254) at org.geotools.jdbc.HeuristicPrimaryKeyFinder.createPrimaryKey(HeuristicPrimaryKeyFinder.java:108) at org.geotools.jdbc.HeuristicPrimaryKeyFinder.getPrimaryKey(HeuristicPrimaryKeyFinder.java:59) at org.geotools.jdbc.CompositePrimaryKeyFinder.getPrimaryKey(CompositePrimaryKeyFinder.java:52) at org.geotools.jdbc.JDBCDataStore.getPrimaryKey(JDBCDataStore.java:1068) at org.geotools.jdbc.JDBCFeatureSource.<init>(JDBCFeatureSource.java:94) at org.geotools.jdbc.JDBCDataStore.createFeatureSource(JDBCDataStore.java:912) at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:389) at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:370) at org.geotools.data.store.ContentDataStore.ensureFeatureStore(ContentDataStore.java:451) at org.geotools.data.store.ContentDataStore.getFeatureWriterAppend(ContentDataStore.java:483) at org.geoserver.importer.Importer.loadIntoDataStore(Importer.java:1043) at org.geoserver.importer.Importer.doIndirectImport(Importer.java:871) at org.geoserver.importer.Importer.run(Importer.java:742) at org.geoserver.importer.Importer.run(Importer.java:692) at org.geoserver.importer.Importer$4.call(Importer.java:768) at org.geoserver.importer.Importer$4.call(Importer.java:765) at org.geoserver.importer.job.Job.call(Job.java:16) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

Because the primary key lookup fails, the primary key is null and we get a read-only FeatureSource, causing the insert to fail:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 java.io.IOException: NE_50M_ADMIN_0_COUNTRIES4 is read only at org.geotools.data.store.ContentDataStore.ensureFeatureStore(ContentDataStore.java:453) at org.geotools.data.store.ContentDataStore.getFeatureWriterAppend(ContentDataStore.java:483) at org.geoserver.importer.Importer.loadIntoDataStore(Importer.java:1043) at org.geoserver.importer.Importer.doIndirectImport(Importer.java:871) at org.geoserver.importer.Importer.run(Importer.java:742) at org.geoserver.importer.Importer.run(Importer.java:692) at org.geoserver.importer.Importer$4.call(Importer.java:768) at org.geoserver.importer.Importer$4.call(Importer.java:765) at org.geoserver.importer.job.Job.call(Job.java:16) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

This is particularily notable when using the importer extension to import shapefiles.

It looks like this error is related to the changes made here: https://github.com/geotools/geotools/commit/3a98d302b9f41006e33da51cc107ba7449e471f9 (Fix for )

seems to be caused by a similar problem.

Environment

Oracle 11.2 running on Windows 2003 server.
Issue was observed on various remote instances of GeoServer 2.7

Status

Assignee

Unassigned

Reporter

Torben Barsballe

Triage

None

Components

Fix versions

Priority

Medium