Re: JDBC problem

From: Richard Reynolds (richiereynoldsNNNN_at_ntlworld.com)
Date: 12/26/03


Date: Fri, 26 Dec 2003 15:20:00 -0000


"cursor" <aleamb@ya.com> wrote in message news:bsg8tg$auc$1@news.ya.com...
>
> Hi.
>
> Im developing JSP/Servlet app on Tomcat 5 with MySQL database (version
> 4.1.1-alpha) and its JDBC Connector (version 2.1)
>
> I have got this code:
>
> stmt = conn.createStatement(
> ResultSet.TYPE_SCROLL_INSENSITIVE,
> ResultSet.CONCUR_UPDATABLE);
>
>
>
> rs = stmt.executeQuery("SELECT * FROM posts");
>
> rs.moveToInsertRow();
>
> rs.updateString("Nick","foo");
>
> rs.insertRow();
>
>
> And rs.moveToInsertRow(); throw the next Exception:
>
> SQLException: Result Set not updatable.This result set must come from a
> statemen
> t that was created with a result set type of ResultSet.CONCUR_UPDATABLE,
the
> query must select only one table, and must select all primary keys from
that
> table.
> See the JDBC 2.1 API Specification, section 5.6 for more details.
>
> But my statemet sets CONCUR_UPDATABLE property and sql query selects
primary
> keys; I dont understand it.
>
> Thank you
>
>
Hi, haven't used jdbc for quite a while now but from your provided info you
might want to try selecting the primary key col from posts rather then *.
I'm just guessing that the crsor implemented by the result set needs to know
which column is the primary key.

Richard.



Relevant Pages

  • Re: Primary Key constraint error
    ... Dan Slaby wrote: ... and sql query. ... However, querying the destination table, the Primary Key does not ... When I use the '=' for the very same individual record, ...
    (microsoft.public.windows.server.general)
  • Re: Trying to simplify an sql query
    ... I am using the following sql query which I feel could be simplified, ... I think I have tried the following construct for the subquery ... to risk hanging the database again. ... As month is no part of the primary key and exists will invariably ...
    (comp.databases.oracle.misc)
  • ASP.NET Datagrid with VB
    ... I've got a datagrid on an asp.net page that loads 4 columns of data from a ... SQL query. ... On the grid, i have an edit command set so that when the button is pressed, ... that specific primary key in another grid. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: HELP! dropdown control is being reset to a value on every postback!
    ... I checked my SQL query I was populating the dropdown with and it ... by SQL to the primary key and the problem went away. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: HELP! dropdown resets to a specific value on postback! (asp.net.vb)
    ... I checked my SQL query I was populating the dropdown with and it ... by SQL to the primary key and the problem went away. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)

Loading