This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Getting error that Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting error that"com.ibm.db 2.jcc.c.SqlException -- Invalid operation: result set closed" in was7" Watch "Getting error that"com.ibm.db 2.jcc.c.SqlException -- Invalid operation: result set closed" in was7" New topic
Author

Getting error that"com.ibm.db 2.jcc.c.SqlException -- Invalid operation: result set closed" in was7

sachin pate
Greenhorn

Joined: May 03, 2013
Posts: 19
try {
vectQueryInput = new Vector();
vectQueryInput.addElement(aCoid.trim());
vectQueryInput.addElement(aCoid.trim());
vectQueryInput.addElement(aCoid.trim());
vectQueryInput.addElement(aCoid.trim());
vectQueryInput.addElement(aCoid.trim());
vectQueryInput.addElement(aCoid.trim());

strQueryFileName = PSVPropertyFileConstant.PROPERTY_FILE_GET_SPCLB_FOR_VIEWPIP;
strSQLQuery = FileUtils.generateQuery(strQueryFileName, vectQueryInput);
con = getConnection(URL,USER,PSWD);
stmt = con.createStatement();
rs = stmt.executeQuery(strSQLQuery);

Model modelB = new Model();

while (rs.next()) {
strAttribute = rs.getString(1);
StringTokenizer st = new StringTokenizer(strAttribute, ":");
while (st.hasMoreTokens()) {
strAttribute = st.nextToken();
strValue = st.nextToken();
if (strAttribute.equals("A")) {
modelB.setVIEWPIPSPCLATT1(strAttribute);
modelB.setVIEWPIPSPCLVAL1(strValue);

} else if (strAttribute.equals("B")) {
modelB.setVIEWPIPSPCLATT2(strAttribute);
modelB.setVIEWPIPSPCLVAL2(strValue);

} else if (strAttribute.equals("C")) {
modelB.setVIEWPIPSPCLATT3(strAttribute);
modelB.setVIEWPIPSPCLVAL3(strValue);

} else if (strAttribute.equals("H")) {
modelB.setVIEWPIPSPCLATT4(strAttribute);
modelB.setVIEWPIPSPCLVAL4(strValue);

} else if (strAttribute.equals("S")) {
modelB.setVIEWPIPSPCLATT5(strAttribute);
modelB.setVIEWPIPSPCLVAL5(strValue);

} else if (strAttribute.equals("T")) {
modelB.setVIEWPIPSPCLATT6(strAttribute);
modelB.setVIEWPIPSPCLVAL6(strValue);
}
}
}

if (rs.wasNull()) {
strAttribute = "";
}

arrSpclBlock.add(modelB);

} catch (SQLException ex) {

ex.printStackTrace();

} catch (Exception e) {
e.printStackTrace();

} finally {
try {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (con != null)
con.close();

} catch (SQLException e) {
e.printStackTrace();
}

}


return arrSpclBlock;
}
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2229
    
    7

Check this out http://www-01.ibm.com/support/docview.wss?uid=swg21461670

What JDBC version you using? Did it work before and now doesn't? Was the JDBC driver updated to a newer version?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
sachin pate
Greenhorn

Joined: May 03, 2013
Posts: 19


What JDBC version you using? Did it work before and now doesn't? Was the JDBC driver updated to a newer version?us

Previously I was using JDBC type2 and Right now I am using JDBC type 4.I also tried your given link but still it giving same error.

Please help me to resolve the issue.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2229
    
    7

The link I posted shows what needs to be done to resolve the problem. eg changing program to cater the rs.next() "not closing after looping all rows".
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
I think this might fit better in a databases forum: moving.
sachin pate
Greenhorn

Joined: May 03, 2013
Posts: 19
The link I posted shows what needs to be done to resolve the problem. eg changing program to cater the rs.next() "not closing after looping all rows".


thank you K.Tsang

Problem resolved.
Thank you again
 
jQuery in Action, 2nd edition
 
subject: Getting error that"com.ibm.db 2.jcc.c.SqlException -- Invalid operation: result set closed" in was7
 
Similar Threads
Problem in getting the data from DB using servlets
string tokeniser .. error unknown source
data mismatch error
LoginBean doesn't compile
a mistake for bean