Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #395
| From | joeNOSPAM@BEA.com.remove-dii-this |
|---|---|
| Subject | Re: java.sql.SQLException |
| Message-ID | <f1e109eb-22bc-41bf-8401-ffcc794bb163@40g2000prx.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.databases |
| References | <0d3339ec-c06f-424f-93f0-446d8d946cb6@a12g200 |
| Date | 2011-04-27 15:23 +0000 |
| Organization | TDS.net |
To: comp.lang.java.databases
Well it's clear that this procedure may not return anything if
it is passed a bogus food code. You need to try the JDBC code
I presented, eg:
findFoodCode.setString(1,input);
findFoodCode.setString(2,request.getParameter("country"));
boolean getResultSetNow = findFoodCode.execute();
int updateCount = -1;
while (true) { // handle all the in-line results from any stored
procedure or SQL
if (getResultSetNow) {
ResultSet r = findFoodCode.getResultSet();
ResultSetMetaData metaData = r.getMetaData();
int col_cmt = metaData.getColumnCount();
while (r.next()) {
// fully process result set before calling getMoreResults()
again!
for(int i=1;i<=col_cnt;i++)
{
out.print(r.getString(i)+";");
}
}
r.close();
} else {
updateCount = findFoodCode.getUpdateCount();
if (updateCount != -1) { // it's a valid update count
System.out.println("Reporting an update count of " +
updateCount);
}
}
if ((!getResultSetNow) && (updateCount == -1)) break; // done
with loop, finished all the returns
getResultSetNow = findFoodCode.getMoreResults();
}
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.databases | Previous | Next | Find similar
Re: java.sql.SQLException joeNOSPAM@BEA.com.remove-dii-this - 2011-04-27 15:23 +0000
csiph-web