Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

java.sql.SQLException: Invalid column index

843859Nov 18 2007 — edited Nov 20 2014
hi,
My goal is to load array or My object (KpiInstanceDt[]),
I don't know why I got this erro, is Oracle this query is work fine..Please I need your help.

I'm getting this error:
org.springframework.jdbc.InvalidResultSetAccessException: PreparedStatementCallback; invalid ResultSet access for SQL [select ki.indx,ki.id,ki.display_name,ki.description,calculation_formula_id,display_mask_id,threshold1,threshold2,threshold3,threshold4,ascending,current_time_frame_id,current_time_count,history_time_frame_id,history_time_count,measure_unit_id,show_team,visible_for_agent,visible_for_super,csets.id as cs_id from kpi_instances ki, cs_teams cst, content_sets csets, deployed_projects dp where ki.cs_indx = cst.cs_indx and cst.TEAM_ID = ? and cst.cs_indx = csets.indx and csets.PROJECT_INDX = dp.indx and dp.project_id = ? and dp.version = ? and visible_for_agent = ?]; nested exception is java.sql.SQLException: Invalid column index
Caused by: java.sql.SQLException: Invalid column index
	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.OraclePreparedStatement.setByteInternal(OraclePreparedStatement.java:4475)
	at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:8961)
	at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8790)
	at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:9512)
	at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:9495)
	at weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:280)
	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:247)
	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:94)
	at org.springframework.jdbc.core.ArgPreparedStatementSetter.setValues(ArgPreparedStatementSetter.java:51)
	at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:592)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:537)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:587)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:616)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:624)
	at com.eglue.deploy.kpi.data.dao.implementation.KpiInstanceJdbcDaoImpl.getKpiInstancesForTeam(KpiInstanceJdbcDaoImpl.java:202)
	at com.eglue.utils.cache.metadata.KpiMetaDataCacheComponent.getKpiInstancesFromDB(KpiMetaDataCacheComponent.java:124)
	at com.eglue.utils.cache.metadata.KpiMetaDataCacheComponent.getKpiInstancesForTeam(KpiMetaDataCacheComponent.java:95)
	at com.eglue.kpi.data.dao.implementation.KpiMetaDataCacheDaoImpl.getKpiInstanceDtArrayForTeam(KpiMetaDataCacheDaoImpl.java:78)
	at com.eglue.kpi.service.implementation.KpiMetaDataServiceImpl.getKpiMetaData(KpiMetaDataServiceImpl.java:104)
	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:585)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy47.getKpiMetaData(Unknown Source)
	at com.eglue.mdb.beans.KpiMetaDataBean.onMessage(KpiMetaDataBean.java:71)
	at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:429)
	at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:335)
	at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:291)
	at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4072)
	at weblogic.jms.client.JMSSession.execute(JMSSession.java:3962)
	at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:4490)
	at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
this is my code:_
Object[] args = new Object[]{teamId,projetcId,version,visibleForSuper,visibleForAgent};		
			try
			{
				metaDataList = (List) getJdbcTemplate().query(KpiMetaDataSqlQuery.SELECT_KPI_INSTANCES_FOR_TEAM_AGENT,args, new RowMapperResultSetExtractor( new KpiInstanceDtMapper()));
			
				//select ki.indx,ki.id,ki.display_name,ki.description,calculation_formula_id,display_mask_id,threshold1,threshold2,threshold3,threshold4,ascending,current_time_frame_id,current_time_count,history_time_frame_id,history_time_count,measure_unit_id,show_team,visible_for_agent,visible_for_super,csets.id as cs_id from kpi_instances ki,cs_teams cst, content_sets csets, deployed_projects dp where ki.cs_indx = cst.cs_indx and cst.TEAM_ID = 'team_1' and cst.cs_indx = csets.indx and csets.PROJECT_INDX = dp.indx and dp.project_id = 'Project_1' and dp.version = 1 and visible_for_agent = 1;
			}catch(Exception ex)
			{
				ex.printStackTrace();
			}
I have this class:
private class KpiInstanceDtMapper implements RowMapper {

		public Object mapRow(ResultSet rs, int rowNum) throws SQLException {

			KpiInstanceDt kpiInstanceDt = new KpiInstanceDtImpl();
			if(rs.next()){

			kpiInstanceDt.setIndx(rs.getLong("ki.indx"));
			kpiInstanceDt.setCsIndx(rs.getLong("cs_indx"));
			kpiInstanceDt.setCsId(rs.getString("ki.cs_id"));
			kpiInstanceDt.setId(rs.getString("ki.id"));
			kpiInstanceDt.setDisplayName(rs.getString("ki.display_name"));
			kpiInstanceDt.setDescription(rs.getString("ki.description"));
			kpiInstanceDt.setCalculationFormulaId(rs.getShort("calculation_formula_id"));
			kpiInstanceDt.setDisplayMaskId(rs.getShort("display_mask_id"));
			kpiInstanceDt.setThreshold1(rs.getDouble("threshold1"));
			kpiInstanceDt.setThreshold2(rs.getDouble("threshold2"));
			kpiInstanceDt.setThreshold3(rs.getDouble("threshold3"));
			kpiInstanceDt.setThreshold4(rs.getDouble("threshold4"));
			kpiInstanceDt.setAscending(rs.getBoolean("ascending"));
			kpiInstanceDt.setCurrentTimeFrameId(rs.getShort("current_time_frame_id"));
			kpiInstanceDt.setCurrentTimeCount(rs.getLong("current_time_count"));
			kpiInstanceDt.setHistoryTimeFrameId(rs.getShort("history_time_frame_id"));
			kpiInstanceDt.setHistoryTimeCount(rs.getLong("history_time_count"));
			kpiInstanceDt.setMeasureUnitId(rs.getShort("measure_unit_id"));
			kpiInstanceDt.setShowTeam(rs.getBoolean("show_team"));
			kpiInstanceDt.setShowHistory(rs.getBoolean("show_history"));
			kpiInstanceDt.setVisibleForAgent(rs.getBoolean("visible_for_agent"));
			kpiInstanceDt.setVisibleForSuper(rs.getBoolean("visible_for_super"));
			}else
			{
				kpiInstanceDt= null;
			}
			return kpiInstanceDt;
		}
	}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2007
Added on Nov 18 2007
9 comments
4,669 views