This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 3049
    
    9

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 OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
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: 3049
    
    9

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: 44616
    
  34
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting error that"com.ibm.db 2.jcc.c.SqlException -- Invalid operation: result set closed" in was7
 
It's not a secret anymore!