Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Oracle 10.2.0.5.0 and 11.2.0.3.0 (the former works, the latter does not)

Java runtime 1.6.0_32

GlassFish 3.1.2 (running on Windows 7 desktop)

GeoTools 2.7.5 and 8.0 RC2 (makes no difference to the problem)

I’m having a problem with a query which passes a STRUCT object generated by GeoTools into an Oracle spatial (near neighbour) query. Query execution is called as a Java prepared statement from a GlassFish application server. The query worked fine on a test database on Oracle 10Gr2, but transferring over to a new 11Gr2 test environment breaks the query and throws the following errors:

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: ORA-29902: error in executing ODCIIndexStart() routine
ORA-22060: argument [2] is an invalid or uninitialized number
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 333
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)

…..

^^^ called by in-house method, when it attempts to execute a prepared statement generated in turn by the following code:

public static PreparedStatement closestGeometries( DBConnection con, String filter,
        oracle.sql.STRUCT centroid, int xMetres, int yMetres ) throws IOException,
        SQLException {
    double radius =  (double)Math.sqrt( (double)( xMetres * xMetres + yMetres * yMetres ) );
    String query = "select a.loc_id, a.geom from loc_aux_geo a "
                 + "join loc_aux_webs b on b.loc_id = a.loc_id "
                 + "where sdo_nn( a.geom, ?, 'sdo_batch_size=0', 1 ) = 'TRUE' "
                 + "and sdo_nn_distance(1) <= ? "
                 + "and b.extant = 'Y' "
                 + "and a.geom.Get_GType() != 1";
    PreparedStatement stmt = con.prepareSelect(query, filter);
    stmt.clearParameters();
    stmt.setObject( 1, centroid );
    stmt.setDouble( 2, radius );
    return stmt;
}

The first two parameters are passed to an in-house wrapper to a standard DB connection; there's no problem there. The passed-in STRUCT object “centroid” is actually a misnomer because it’s a polygon geometry, not a point, although the code should generalise to points as well. "Centroid" is instantiated with an SRID of 8307. The tables look the same on both databases, and the spatial index has been rebuilt and looks clean. Has anyone got any idea why this should work with Oracle 10Gr2 and not 11Gr2? Could it be something to do with dimensionality (2D vs 3D)?

Regards,

Warren

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.