Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StringIndexOutOfBoundsException

Status
Not open for further replies.

martindavey

Programmer
Jan 2, 2000
122
GB
Hi,

I have a list box of urban sprawls (Manchester, Norwich, etc.) The user may select none, 1 or more of these - there are over 500 in the list.
The result is concatenated into a string which ends up looking like:
String sql = "{ Call INFRA.shape_search('p00001000482626','URBAN_SPRAWLS_2','PX00000515',' and name in (''Ferndown'',''Fleet'',''Flint''...etc"

Then When I execute:
CallableStatement cstmt = conn.prepareCall(sql);

I get this error:
java.lang.StringIndexOutOfBoundsException: String index out of range: 3143
at java.lang.String.charAt(String.java:558)
at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:123)
at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:69)
at oracle.jdbc.driver.OracleConnection.nativeSQL(OracleConnection.java:1217)
at oracle.jdbc.driver.OracleStatement.expandSqlEscapes(OracleStatement.java:6670)
at oracle.jdbc.driver.OracleStatement.parseSqlKind(OracleStatement.java:6659)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:152)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:77)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:48)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1169)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1024)
at com.clearchannel.mi.MappingOracleLayerLoader.createShapeProximity(MappingOracleLayerLoader.java:976) <-- The prepare call line.

What should I do?

Help appreciated, Martin.
 
1) Call the procedure with the exact parameters that are failing on your Java app, and see if it executes correctly.

2) Could be a driver bug - try upgrading your driver if "1)" succeeds.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top