> Hi all,
>
[quoted text clipped - 26 lines]
> Thanks and regards,
> Max.
Max,
It appears you're using MySQL (because I wrote the error message).
If you take a look at the JDBC spec, a JDBC driver _can_ require that
updatable result sets are from queries that reference a single-table,
and that have primary keys, and that the query selects all primary keys.
This is in fact, required when using MySQL, because MySQL doesn't
currently have cursors. For updatable result sets, the JDBC driver has
to be _positively_ sure that it can in fact _uniquely_ identify the row
you are modifying. Without primary keys, this is not possible (in fact,
many other databases that actually have cursors require this as well,
e.g. Oracle is one that immediately comes to mind).
From Section 5.6 of the JDBC-2.0 specification:
"Due to differences in database implementations, the JDBC API does not
specify an exact set of SQL queries which must yield an updatable result
set for JDBC drivers that support updatability. Developers can, however,
generally expect queries which meet the following criteria to produce an
updatable result set:
1. The query references only a single table in the database.
2. The query does not contain any join operations.
3. The query selects the primary key of the table it references.
In addition, an SQL query should also satisfy the conditions listed
below if inserts are to be performed.
4. The query selects all of the non-nullable columns in the underlying
table.
5. The query selects all columns that don’t have a default value."
Regards,
-Mark

Signature
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com
Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/
Max - 16 Mar 2004 15:57 GMT
Hi Mark,
The table i created (sub_item), contain primary keys. but my "index" is a
auto_increment column, and i think it is "NULL" by default, will that
affect?
Max.
> > Hi all,
> >
[quoted text clipped - 4 lines]
> > I have also create the statement to a scrollable and updateable type as
> > follow :
"prepareStatement(query,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_U
> > PDATABLE);
> >
[quoted text clipped - 66 lines]
>
> Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/
Mark Matthews - 16 Mar 2004 16:02 GMT
> Hi Mark,
>
> The table i created (sub_item), contain primary keys. but my "index" is a
> auto_increment column, and i think it is "NULL" by default, will that
> affect?
Max,
What does 'SHOW CREATE TABLE sub_item' say? You better see a 'PRIMARY
KEY' clause in there ;)
Just having an index is _not_ a primary key. Primary keys have to be
explicitly defined.
-Mark

Signature
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com
Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/
Max - 18 Mar 2004 01:34 GMT
Hi Mark,
The primary key of the sub_item is "no" (this is the one with auto_increment
column). Actually i'm pretty sure about the requirement for the Table...
except the column "no" is a NULL by default.
Max.
> > Hi Mark,
> >
[quoted text clipped - 19 lines]
>
> Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/
Mark Matthews - 18 Mar 2004 18:35 GMT
> Hi Mark,
>
[quoted text clipped - 3 lines]
>
> Max.
Max, it's not a primary key, then. You can only define primary keys as
NOT NULL.
Once again, what is the complete output of 'SHOW CREATE TABLE sub_item'?
If there isn't the word 'PRIMARY KEY' in there, then you don't have a
primary key.
-Mark

Signature
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com
Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/