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


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

Re: java.sql.SQLException

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Lew" <lew@THRWHITE.remove-dii-this>
Subject Re: java.sql.SQLException
Message-ID <ghebi6$56v$1@news.albasani.net> (permalink)
X-Comment-To comp.lang.java.databases
Newsgroups comp.lang.java.databases
In-Reply-To <c0df6549-23ae-46c0-9496-45be55a5591c@z27g2000prd.googlegroups.com>
References <c0df6549-23ae-46c0-9496-45be55a5591c@z27g2000prd.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 46
Date Wed, 27 Apr 2011 15:23:25 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917805 96.60.20.240 (Wed, 27 Apr 2011 10:23:25 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:23:25 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.databases:385

Show key headers only | View raw


  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 | NextPrevious in thread | Find similar


Thread

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