netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Database update table bug

Open doitsexy opened this issue 6 months ago • 5 comments

Apache NetBeans version

Apache NetBeans 25

What happened

Image table alias error

UPDATE "isms"."TSOSOA1 t"

Language / Project Type / NetBeans Component

No response

How to reproduce

excute "select * from table t where t.aaa='xxxx' " modify some data click commit records button will show the error and the update sql will be : update "table t" the correct sql is : update table ,no t

Did this work correctly in an earlier version?

No / Don't know

Operating System

windows11

JDK

jdk1.8

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

doitsexy avatar May 15 '25 02:05 doitsexy

What JDBC driver and DBMS was used?

matthiasblaesing avatar May 15 '25 04:05 matthiasblaesing

What JDBC driver and DBMS was used?

ojdbc6.jar, Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage

keepgoodwork avatar May 20 '25 01:05 keepgoodwork

Image there has other problems, i must delete the double quotation marks to use:
update xsms.tvava07 or it will show an error

keepgoodwork avatar May 20 '25 02:05 keepgoodwork

What JDBC driver and DBMS was used?

I know the problem. The scheme and table name must be uppercase

keepgoodwork avatar May 20 '25 05:05 keepgoodwork

The problem is, that the statement generator has to guess what is the right thing to do for identifiers. What happens here is:

  • NetBeans tries to extract the catalog, schema and table name from the resultset
  • Oracle does not provide that data
  • NetBeans now guesses the data from the SQL
  • NetBeans then checks if the identifier needs to be quoted and in this case based on difference between identifier casing and "should" casing, decides to quote
  • Oracle does not like the quoted value and errors out

Quite frankly: Every non-trivial query/update with this will fail on Oracle, but that should be discussed with oracle. They could fix the metadata for a resultset. I'll let this stay open, but don't plan to further work on this.

matthiasblaesing avatar May 20 '25 17:05 matthiasblaesing