This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 189051

Summary: DB Outpus always shows "Line 1, column 1" as error location
Product: db Reporter: kRk
Component: SQL EditorAssignee: matthias42
Status: RESOLVED FIXED    
Severity: normal CC: kalali, kRk, romanmostyka
Priority: P2 Keywords: USABILITY
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: NB Screenshot
pgAdmin screenshot

Description kRk 2010-07-29 13:41:38 UTC
After runing wrong SQL Query, output always shows "Line 1, column 1" as error location. 
Therefore debugging is difficult.

DB: PostgresSQL 8.4.2 (org.postgresql.Driver)
Product Version = NetBeans IDE 6.9 (Build 201006101454)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_20
Runtime = Java HotSpot(TM) Client VM 16.3-b01
Comment 1 kRk 2010-07-29 13:47:20 UTC
Created attachment 101081 [details]
NB Screenshot
Comment 2 kRk 2010-07-29 13:51:12 UTC
Created attachment 101082 [details]
pgAdmin screenshot

For comparison: error message in pgAdmin of the same query.
It would be nice if the NB shows error information in similar way.
Comment 3 kRk 2012-02-15 12:48:12 UTC
Any updates here?
Comment 4 matthias42 2012-02-16 20:23:01 UTC
I had a quick look at the problem. The information you need is only available in a database specific way and not accessible when only using standard jdbc.

To be more specific you'd have to extract the org.postgresql.util.ServerErrorMessage from the Exception and grab the Location via getPosition().

Without a hard dependency on the driver you could only use reflection to access the parameters. A good idea who to implement this is needed.
Comment 5 matthias42 2012-07-12 19:34:45 UTC
*** Bug 68585 has been marked as a duplicate of this bug. ***
Comment 6 matthias42 2013-05-13 19:53:44 UTC
*** Bug 155170 has been marked as a duplicate of this bug. ***
Comment 7 matthias42 2016-01-17 16:52:12 UTC
The implementation of this feature was fixed as:

http://hg.netbeans.org/core-main/rev/ef124a30ae2b

the fix implements position extraction for the DBs PostgresSQL, Informix, Derby and H2. MySQL, MSSQL and Oracle were checked but did not provide enought information.

In the next few days a nightly build will be produced that contains the fix. By then a message will be posted here. Please check that nightly and if you find this fixed, please change status of this issue to VERIFIED. If not please specify what did not work.
Comment 8 Quality Engineering 2016-01-19 02:27:03 UTC
Integrated into 'main-silver', will be available in build *201601190002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ef124a30ae2b
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #189051: Extract error location from server reply on sql execution
Comment 9 Quality Engineering 2017-01-12 04:02:19 UTC
Integrated into 'main-silver', will be available in build *201701120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7fdd3974b83e
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #268794: Revert automatic caret movement introduced with fix for #189051

The intention of the implementation was  to make it easier to react to errors, but
in bug report #268794 valid points were raised, that made this impractical:

- The cursor was already at the offending place within the query.
- The query is executed, then the editor changes are being made while a long
  running query is executing, the cursor changes position while still typing
  after the execution completes.

As not all DBMS return valid or precise locations, this part of the fix is reverted.