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.

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: problem in inserting record in ms access.
Date 2012-10-04 19:39 +0000
Organization UK Free Software Network
Message-ID <k4kol6$v70$1@localhost.localdomain> (permalink)
References <110ed4b2-e29a-4c6d-81df-3eee8e532a7c@googlegroups.com>

Show all headers | 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 | NextPrevious 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