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


Groups > comp.lang.java.programmer > #19106

Re: problem in inserting record in ms access.

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!usenet.ukfsn.org!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: problem in inserting record in ms access.
Date Thu, 4 Oct 2012 19:39:18 +0000 (UTC)
Organization UK Free Software Network
Lines 24
Message-ID <k4kol6$v70$1@localhost.localdomain> (permalink)
References <110ed4b2-e29a-4c6d-81df-3eee8e532a7c@googlegroups.com>
NNTP-Posting-Host 84.45.235.129
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace localhost.localdomain 1349379558 31968 84.45.235.129 (4 Oct 2012 19:39:18 GMT)
X-Complaints-To usenet@localhost.localdomain
NNTP-Posting-Date Thu, 4 Oct 2012 19:39:18 +0000 (UTC)
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Xref csiph.com comp.lang.java.programmer:19106

Show key headers only | View raw


On Wed, 03 Oct 2012 21:47:34 -0700, Navnath Gadakh wrote:

Your problem is here:

>             st = con.createStatement();
>

By default this statement causes executeQuery() to create a non-
updateable ResultSet, so your second try/catch block will fail when you 
try to update it. The Javadocs entry for the ResultSet Interface makes 
this quite clear. It also explains how to create updateable ResultSets.

As a minor point, why use two try/catch blocks when one will do?

Be aware that a thrown SQLException frequently is the head of a chain on 
related SQLException, so your catch block should show the messages from 
every exception in the chain or you can miss seeing all the debugging 
information that JDBC makes available.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

problem in inserting record in ms access. Navnath Gadakh <navnathgadakh@gmail.com> - 2012-10-03 21:47 -0700
  Re: problem in inserting record in ms access. Martin Gregorie <martin@address-in-sig.invalid> - 2012-10-04 19:39 +0000
  Re: problem in inserting record in ms access. Arne Vajhøj <arne@vajhoej.dk> - 2012-10-04 17:35 -0400
    Re: problem in inserting record in ms access. Martin Gregorie <martin@address-in-sig.invalid> - 2012-10-04 23:24 +0000
      Re: problem in inserting record in ms access. Arne Vajhøj <arne@vajhoej.dk> - 2012-10-05 20:27 -0400
        Re: problem in inserting record in ms access. Martin Gregorie <martin@address-in-sig.invalid> - 2012-10-06 11:36 +0000
          Re: problem in inserting record in ms access. Arne Vajhøj <arne@vajhoej.dk> - 2012-10-06 09:08 -0400
  Re: problem in inserting record in ms access. Roedy Green <see_website@mindprod.com.invalid> - 2012-10-04 20:33 -0700
    Re: problem in inserting record in ms access. Lew <lewbloch@gmail.com> - 2012-10-05 10:48 -0700

csiph-web