[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    RE: Updateable ResultSets
From:       JR Ruggentaler <jr () mpv ! com>
Date:       2002-04-10 16:22:26
[Download RAW message or body]

Mark,
	I removed the call to rs.refreshRow() but the next call is
rs.getObject(1) which throws the following exception.

java.sql.SQLException: Operation not allowed after ResultSet closed 	at
org.gjt.mm.mysql.ResultSet.checkRowPos(Unknown Source) 	at
org.gjt.mm.mysql.ResultSet.getObject(Unknown Source) 

I didn't close anything. The code inserts a row then attempts to get all the
values from the inserted row by calling rs.getObject(1..last column) in a
loop. My app uses a JTable with a  table model that gets data from the
ResultSet and manages the data in a Vector of Vectors. 

J.R.

-----Original Message-----
From: Mark Matthews [mailto:mmatthew@thematthews.org]
Sent: Wednesday, April 10, 2002 10:51 AM
To: JR Ruggentaler; java@lists.mysql.com
Subject: Re: Updateable ResultSets


The driver now takes care of this for you. Your primary key field will be
updated with the auto_increment value (if there is only one primary key
field, that is). Does that solution work for you?

    -Mark
----- Original Message -----
From: "JR Ruggentaler" <jr@mpv.com>
To: "Mark Matthews" <mmatthew@thematthews.org>; "JR Ruggentaler"
<jr@mpv.com>
Cc: <java@lists.mysql.com>
Sent: Wednesday, April 10, 2002 10:23 AM
Subject: RE: Updateable ResultSets


> Mark,
> I set the primary key to null and MySql auto fills the primary key
> field on insert. I would like to get the primary key value after the
insert
> incase the user wants to delete the last row inserted. Basically I have a
> JTable showing all the fields in my table except the primary key field.
The
> user can create, update and delete rows. If the user creates a row and
then
> decide to delete it the cursor would be pointing to the inserted row which
> has a null in the primary key field.
>
> J.R.
>
> -----Original Message-----
> From: Mark Matthews [mailto:mmatthew@thematthews.org]
> Sent: Wednesday, April 10, 2002 9:38 AM
> To: JR Ruggentaler
> Cc: java@lists.mysql.com
> Subject: Re: Updateable ResultSets
>
>
> Why do you need to do a refreshRow() after an insertRow(). The result set
> already has the latest data.
>
>     -Mark
> ----- Original Message -----
> From: "JR Ruggentaler" <jr@mpv.com>
> To: "Mark Matthews" <mmatthew@thematthews.org>; "JR Ruggentaler"
> <jr@mpv.com>; <java@lists.mysql.com>
> Sent: Wednesday, April 10, 2002 8:22 AM
> Subject: RE: Updateable ResultSets
>
>
> > I tried the 2.0.12 driver and the results changed but I continue to
> receive
> > and exception.
> >
> > java.sql.SQLException: After end of result set. Can not call
refreshRow().
> > at org.gjt.mm.mysql.jdbc2.ResultSet.refreshRow(Unknown Source)
> >
> > Any work around for this problem?
> >
> > P.S. Thanks for your quick response Mark.
> >
> > J.R.
> >
> > -----Original Message-----
> > From: Mark Matthews [mailto:mmatthew@thematthews.org]
> > Sent: Wednesday, April 10, 2002 5:58 AM
> > To: JR Ruggentaler; java@lists.mysql.com
> > Subject: Re: Updateable ResultSets
> >
> >
> > Upgrade to 2.0.12 from http://sourceforge.net/projects/mmmysql/
> >
> >     -Mark
> > ----- Original Message -----
> > From: "JR Ruggentaler" <jr@mpv.com>
> > To: <java@lists.mysql.com>
> > Sent: Tuesday, April 09, 2002 10:59 PM
> > Subject: Updateable ResultSets
> >
> >
> > > I am getting the following exception when I call rs.insertRow()
followed
> > by
> > > rs.refreshRow() on a updateable ResultSet:
> > >
> > > org.gjt.mm.mysql.jdbc2.NotImplemented
> > > at org.gjt.mm.mysql.jdbc2.ResultSet.refreshRow(ResultSet.java:1972)
> > >
> > > I am using mm.mysql-2.0.7-bin.jar. Is ResultSet.refreshRow() supported
> in
> > > the newer versions of the driver? Is there a workaround?
> > >
> > > Thanks in advance!
> > > J.R.
> > >
> > > ---------------------------------------------------------------------
> > > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"
> before
> > > posting. To request this thread, e-mail
java-thread3576@lists.mysql.com
> > >
> > > To unsubscribe, send a message to the address shown in the
> > > List-Unsubscribe header of this message. If you cannot see it,
> > > e-mail java-unsubscribe@lists.mysql.com instead.
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"
before
> > posting. To request this thread, e-mail java-thread3581@lists.mysql.com
> >
> > To unsubscribe, send a message to the address shown in the
> > List-Unsubscribe header of this message. If you cannot see it,
> > e-mail java-unsubscribe@lists.mysql.com instead.
> >
> >
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail java-thread3584@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail java-unsubscribe@lists.mysql.com instead.
>
>

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread3586@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic