Back Forum Reply New

Error While Calling Stored Procedure

Hi,
I have done quite a bit with spring framework but its my first time to call Oracle Stored Procedure via spring using sping's StoredProcedure class. When I call my snapshotData() method, it goes in the infinite loop as follows. Call to this function is not in spring transcation.

[11/23/09 9:29:41:278 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-1
[11/23/09 9:29:41:293 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-2
[11/23/09 9:29:41:293 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-3
[11/23/09 9:29:41:293 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-4
[11/23/09 9:29:41:293 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-5
[11/23/09 9:29:41:293 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-6
[11/23/09 9:29:41:293 EST] 00000026 JdbcTemplate  I org..jdbc.core.JdbcTemplate extractReturnedResults Added default SqlReturnUpdateCount parameter named #update-count-7

.... and so on it goes to infinite loop. Then I have to kill my websphere app server.Here is how I am using StoredProcedure class. Oracle Stored procedure is in a oracle package.Code:
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
import org..jdbc.core.SqlOutParameter;
import org..jdbc.core.SqlParameter;
import org..jdbc.object.StoredProcedure;

public class StoredProcedureDAO {

private DataSource dataSource;

public void snapshotData(Long applicationId, Long applicantId){
String status = quot;quot;;
MyStoredProcedure sproc = new MyStoredProcedure(applicationId, applicantId);
status = sproc.execute(status, applicationId, applicantId);

}

private class MyStoredProcedure extends StoredProcedure {
private static final String SQL_SP= quot;HISTORY.snapshot_dataquot;;
private static final String STATUS_OUT_PARAM= quot;p_statusquot;;
private static final String APPLICATION_ID_IN_PARAM= quot;p_application_idquot;;
private static final String APPLICANT_ID_IN_PARAM= quot;p_applicant_idquot;;

public MyStoredProcedure(Long applicationId, Long applicantId) {
super(dataSource, SQL_SP);
declareParameter(new SqlOutParameter(STATUS_OUT_PARAM, Types.VARCHAR));
declareParameter(new SqlParameter(APPLICATION_ID_IN_PARAM, Types.BIGINT));
declareParameter(new SqlParameter(APPLICANT_ID_IN_PARAM, Types.BIGINT));
compile();
}

@SuppressWarnings(quot;uncheckedquot;)
public String execute(String status, Long applicationId, Long applicantId) {
Maplt;String, Objectgt; inputs = new HashMaplt;String, Objectgt;();
inputs.put(STATUS_OUT_PARAM, status);
inputs.put(APPLICATION_ID_IN_PARAM, applicationId);
inputs.put(APPLICANT_ID_IN_PARAM, applicantId);

Map outParams = execute(inputs);       if (outParams.size() gt; 0) {       status = outParams.get(STATUS_OUT_PARAM).toString();       }
return quot;quot;;
}
}

public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}

}
p_status, p_application_id and p_applicant_id are the exact parameter names defined in the oracle stored procedure definition. If I call this SP using toad, it works fine as expected.

I am calling the above class as follows.storedProcedureDAO is injected.Code:

storedProcedureDAO.snapshotApplicationData(121L,444L);
Env Info: I am using Spring 2.5.6 along with Oracle 11g database and using oracle14.jar as jdbc interface to oracle.

Any help/clue will be highly appreciated.

I have resolved the issue. I updated the oracle jdbc jar file from 10.1.0.2.0 version to 10.2.0.4.0. Also I moved from StoredProcedure class to SimpleJdbcCall.
¥
Back Forum Reply New