Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #385
| From | "Lew" <lew@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: java.sql.SQLException |
| Message-ID | <ghebi6$56v$1@news.albasani.net> (permalink) |
| Newsgroups | comp.lang.java.databases |
| References | <c0df6549-23ae-46c0-9496-45be55a5591c@z27g2000prd.googlegroups.com> |
| Date | 2011-04-27 15:23 +0000 |
| Organization | TDS.net |
To: comp.lang.java.databases Zhane wrote: > I read the metadata to check for number of columns to prevent rs2.next > () from reading when it is 0 (an update); That reply doesn't seem connected to the response: John B. Matthews wrote: >> Presumably, findFoodCode is a PreparedStatement containing an UPDATE >> statement instead of a SELECT statement, as expected by executeQuery(). This should tell you that - you need to tell us what went into 'findFoodCode', preferably as part of an SSCCE: <http://sscce.org/> because - 'findFoodCode' doesn't hold a query, rather it holds an update statement, thus 'executeQuery()' will always throw an exception. I'm not clear how that you are reading the metadata pertains to the comments you've received. Presumably (one must presume because you haven't given us the entire error message) the error message refers to the line of code that threw the exception, and that exception occurred prior to the 'getMetaData()' call. Quite aside from the fact that it's fairly difficult to get help from people to whom you've given so little information, although we're really trying, the debugging process for oneself involves using all the information that the system gives you. Line numbers, details of the contents of the SQL statement, stack traces - all these data point you to the actual problem, and thence to the solution. Please indicate how you've actually used the answers you've received here next time you post on this topic, and provide more details if you're still having trouble. For example - what is the SQL that you're trying to execute? (Hint: UPDATE does not return a result set.) -- Lew --- * 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 — Previous in thread | Find similar
Re: java.sql.SQLException "Zhane" <zhane@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000 Re: java.sql.SQLException "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
csiph-web