Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invalid argument: parameter index 1 is out of range  RSS feed

 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am getting the following Sql Error message... "Invalid argument: parameter index 1 is out of range"

My seq statement is like this: SELECT CODE, DESCRIPTION FROM SCHEMA.CTMTORG WHERE SUBLEVELFLAG=? and GEOCODE=?

and my DAO class has the following statement..like this :
SUBLEVELFLAG="N"
pStat = connection.prepareStatement(sql);
pStat.setString(SettingsConstants.ONE,SUBLEVELFLAG);
pStat.setString(SettingsConstants.TWO,geoCode.trim());
rSet = pStat.executeQuery();
while (rSet.next()) {...} rest of the code..
what may be the problem??
Thanks in advance.... :-)
 
Scott Selikoff
author
Bartender
Posts: 4081
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the code that defines the setting constants?
 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the code..
public interface SettingsConstants {
/**
* Value ONE.
*/
int ONE = 1;
/**
* Value TWO.
*/
int TWO = 2;
}

actually these are constants I have defined
 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell why and in what circunstances this error comes...
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudipen,
Does it fail on the prepared statement or result set code? The prepared statement part looks right.
 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Actually the stack trace looks like this...


com.ibm.db2.jcc.a.SqlException: Invalid argument: parameter index 1 is out of range.
at com.ibm.db2.jcc.a.id.e(id.java(Inlined Compiled Code))
at com.ibm.db2.jcc.a.id.d(id.java(Inlined Compiled Code))
at com.ibm.db2.jcc.a.id.b(id.java(Compiled Code))
at com.ibm.db2.jcc.a.id.setString(id.java(Compiled Code))
at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreHelper.psSetString(InternalGenericDataStoreHelper.java(Compiled Code))
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setString(WSJdbcPreparedStatement.java(Compiled Code))
at com.ibm.services.epricer.settings.managegeocountries.dao.SQLOrganization.getAllCountriesFromORGForGeo(SQLOrganization.java:58)
at


Thanks...
 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Continueing from the above post...

at com.ibm.services.epricer.settings.managegeocountries.dao.SQLOrganization.getAllCountriesFromORGForGeo(SQLOrganization.java:58)


at line 58 of SQLOrganization.java..I have this line...

pStat.setString(SettingsConstants.ONE,SUBLEVELFLAG);

where the SUBLEVELFLAG = "N"

Thanks again
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudipen,
The only thing I can think of is that "sql" is a different value than you think it is. We've verified that "1" is being passed and that it is indeed failing on the PreparedStatement.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!