Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #395

Re: java.sql.SQLException

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From joeNOSPAM@BEA.com.remove-dii-this
Subject Re: java.sql.SQLException
Message-ID <f1e109eb-22bc-41bf-8401-ffcc794bb163@40g2000prx.googlegroups.com> (permalink)
X-Comment-To comp.lang.java.databases
Newsgroups comp.lang.java.databases
In-Reply-To <0d3339ec-c06f-424f-93f0-446d8d946cb6@a12g200
References <0d3339ec-c06f-424f-93f0-446d8d946cb6@a12g200
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 42
Date Wed, 27 Apr 2011 15:23:28 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917808 96.60.20.240 (Wed, 27 Apr 2011 10:23:28 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:23:28 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.databases:395

Show key headers only | View raw


  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


Thread

Re: java.sql.SQLException joeNOSPAM@BEA.com.remove-dii-this - 2011-04-27 15:23 +0000

csiph-web