Do not use on any
shared computer
September 5, 2008 03:10am pdt
 
[x]
Attachment Details

Using Springs JDBC Framework ,Getting Open Cursor Issues

Tags: Spring JDBC Framework, 2.X, www.springframework.org
Hi ,

I am Using Spring Framework and calling Procedures by using Springs in built Jdbc support.
I am getting Open cursor issues in database, I have attached the code I am using , can you tell me whether springs Jdbc framework is reliable or not, or is there any issue in the code ? that I need to change or add. Please provide solution to my problem.let me knw inccase u need any more details
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
package com.ge.comfin.fleet.search.jdbc;
 
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
 
import javax.sql.DataSource;
 
import oracle.jdbc.OracleTypes;
 
import org.dom4j.Document;
import org.dom4j.Element;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.StoredProcedure;
 
import com.ge.comfin.fleet.search.common.SearchLogger;
 
public class CallGetDriverQueue extends StoredProcedure {
 
    private static final String STORED_PROC_NAME = "OPNSUTIL.SEARCH_RESULTS.SP_SEARCH_DRIVER";
    private static final SearchLogger logger = new SearchLogger(CallGetDriverQueue.class.getName());
    private Element srchType = null;
 
    public CallGetDriverQueue(DataSource ds) throws SQLException {
 
        super(ds, STORED_PROC_NAME);
        DriverQueueRowMapper driverQueueRowMapper = new DriverQueueRowMapper();
        declareParameter(new SqlParameter("i_Corp", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Fleet", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_First_Name", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Last_Name", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Email", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Unique_Value", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Individual_Id", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Log_Number", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Userid", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_User_Type", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Page_No", OracleTypes.INTEGER));
        declareParameter(new SqlParameter("i_Page_Width", OracleTypes.INTEGER));
        declareParameter(new SqlParameter("i_Pri_Order_Column", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Pri_Order_Direction", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Sec_Order_Column", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Sec_Order_Direction", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Pagename", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Only_Count", OracleTypes.VARCHAR));
        declareParameter(new SqlParameter("i_Name_Validation", OracleTypes.VARCHAR));
        declareParameter(new SqlOutParameter("o_Cur_Queue", OracleTypes.CURSOR, driverQueueRowMapper));
        declareParameter(new SqlOutParameter("o_Error_Message", OracleTypes.VARCHAR));
        declareParameter(new SqlOutParameter("o_Error_Code", OracleTypes.VARCHAR));
        compile();
    }
 
    public Map execute(Document inputXML) throws SQLException {
 
        Map<String, String> inParams = new HashMap<String, String>(5);
        logger.logMessage("INPUT XML ---------- " + inputXML.asXML());
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("CORP"))
        	inParams.put("i_Corp", inputXML.getRootElement().element("OPERATION_INPUTS").element("CORP").getText());
        else
        	inParams.put("i_Corp", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("FLEET"))
        	inParams.put("i_Fleet", inputXML.getRootElement().element("OPERATION_INPUTS").element("FLEET").getText());
        else
        	inParams.put("i_Fleet", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("DRIVER_FIRST_NAME"))
        	inParams.put("i_First_Name", inputXML.getRootElement().element("OPERATION_INPUTS").element("DRIVER_FIRST_NAME").getText());
        else
        	inParams.put("i_First_Name", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("DRIVER_LAST_NAME"))
        	inParams.put("i_Last_Name", inputXML.getRootElement().element("OPERATION_INPUTS").element("DRIVER_LAST_NAME").getText());
        else
        	inParams.put("i_Last_Name", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("EMAIL"))
        	inParams.put("i_Email", inputXML.getRootElement().element("OPERATION_INPUTS").element("EMAIL").getText());
        else
        	inParams.put("i_Email", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("UNIQUE_ID_VALUE"))
        	inParams.put("i_Unique_Value", inputXML.getRootElement().element("OPERATION_INPUTS").element("UNIQUE_ID_VALUE").getText());
        else
        	inParams.put("i_Unique_Value", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("INDIVIDUAL_ID"))
        	inParams.put("i_Individual_Id", inputXML.getRootElement().element("OPERATION_INPUTS").element("INDIVIDUAL_ID").getText());
        else
        	inParams.put("i_Individual_Id", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("LOG_NUMBER"))
        	inParams.put("i_Log_Number", inputXML.getRootElement().element("OPERATION_INPUTS").element("LOG_NUMBER").getText());
        else
        	inParams.put("i_Log_Number", "");
        
        inParams.put("i_Userid", inputXML.getRootElement().element("USER_ID").getText());
        inParams.put("i_User_Type", inputXML.getRootElement().element("USER_TYPE").getText());
        inParams.put("i_Page_No", inputXML.getRootElement().element("OPERATION_INPUTS").element("PAGE_NUMBER").getText());
        inParams.put("i_Page_Width", inputXML.getRootElement().element("OPERATION_INPUTS").element("PAGE_WIDTH").getText());
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_PRI_COL"))
        	inParams.put("i_Pri_Order_Column", inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_PRI_COL").getText());
        else	
        	inParams.put("i_Pri_Order_Column", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_PRI_DIR"))
        	inParams.put("i_Pri_Order_Direction", inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_PRI_DIR").getText());
        else
        	inParams.put("i_Pri_Order_Direction", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_SEC_COL"))
        	inParams.put("i_Sec_Order_Column", inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_SEC_COL").getText());
        else
        	inParams.put("i_Sec_Order_Column", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_SEC_DIR"))
        	inParams.put("i_Sec_Order_Direction", inputXML.getRootElement().element("OPERATION_INPUTS").element("SORT_BY_SEC_DIR").getText());
        else
        	inParams.put("i_Sec_Order_Direction", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("PAGE_NAME"))
        	inParams.put("i_Pagename", inputXML.getRootElement().element("OPERATION_INPUTS").element("PAGE_NAME").getText());
        else
        	inParams.put("i_Pagename", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("ONLY_COUNT"))
        	inParams.put("i_Only_Count", inputXML.getRootElement().element("OPERATION_INPUTS").element("ONLY_COUNT").getText());
        else
        	inParams.put("i_Only_Count", "");
        
        if(null != inputXML.getRootElement().element("OPERATION_INPUTS").element("NAME_VALIDATION"))
        	inParams.put("i_Name_Validation", inputXML.getRootElement().element("OPERATION_INPUTS").element("NAME_VALIDATION").getText());
        else
        	inParams.put("i_Name_Validation", "");
 
        return execute(inParams);
    }
 
    public Element getSrchType() {
        return srchType;
    }
 
    public void setSrchType(Element srchType) {
        this.srchType = srchType;
    }
}
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Programming
Question Asked By: nitinasati
Solution Provided By: girionis
Participating Experts: 1
Solution Grade: C
Views: 39
Translate:
Loading Advertisement...
 
[+][-]Accepted Solution by girionis
Accepted Solution by girionis:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628