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 269357 - Oracle - Null is displayed when result column type is 'timestamp with timezone'
Summary: Oracle - Null is displayed when result column type is 'timestamp with timezone'
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: Dev
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-15 15:48 UTC by pcodes
Modified: 2017-01-13 19:34 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
result_output (8.86 KB, image/png)
2016-12-20 17:19 UTC, pcodes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pcodes 2016-12-15 15:48:01 UTC
When querying an Oracle database and the result column type is 'timestamp with timezone' the value is displayed as "null".

The problem is seen with the query: select current_timestamp from dual;

The data type of current_timestamp is 'timestamp with timezone'. When the data type is just 'timestamp' the correct value is displayed, as seen with the query: select localtimestamp from dual;
Comment 1 matthias42 2016-12-17 21:11:57 UTC
I can't completely reproduce this issue. What I'm seeing is that an oracle specific object is returned and its toString() result is outputted in the output table (not null!).

Non the less this lead to the right track: The "TIMEZONE WITH TIMESTAMP" column in the result set is not correctly handled. Oracle return "-101" as the sql type, which was not yet handled.

The timestamp value can in fact  be accessed with the normal JDBC getTimestamp() method.

I pushed a fix as:

http://hg.netbeans.org/core-main/rev/99cc66742730

Please verify that fix from the upcoming nightlies. If you find the issue fixed please change the status of this bug to VERIFIED. If not, please reopen and give the version of your DB driver and the DBMS. Thank you!
Comment 2 pcodes 2016-12-20 17:19:58 UTC
Created attachment 163284 [details]
result_output
Comment 3 pcodes 2016-12-20 17:25:52 UTC
The issue doesn't appear resolved. I'm testing with the nightly build called netbeans-trunk-nightly-201612200001.zip. I'm not sure if that should have your fix, but I assume it would.

I have more information on the problem. I've updated my driver version and now see similar output that you described (what appears to be the toString() method output).

JDBC Driver (ojdbc7.jar): Oracle Database 12c Release 1 (12.1.0.2) JDBC Driver
Database: Oracle Database 12c Enterprise Edition Version 12.1.0.2.0 (64 bit Production)

The result when the data type is "timestamp with timezone" is similar to this: oracle.sql.TIMESTAMPTZ@2bca2dd6

See attached image.


For reference, using my older driver (ojdbc5.jar):

I found that when I set the connection property "use scrollable cursors" to true, then I get the <Null> result when the column type is "timestamp with timezone".

When I don't set "use scrollable cursors", I get what appears to be the toString() output on the java object (example output: oracle.sql.TIMESTAMPTZ@2bca2dd6).
Comment 4 matthias42 2016-12-20 18:56:10 UTC
Sorry - the nightlies are build from verified changesets. So commits don't appear in the nightlies the next day. When it happens a message should be posted here from the build bot.

I saw the same image you saw with the update drivers. 

With regard to scrollable cursors: Oracle DB was one of the failing DBs which triggered that I removed using scrollable cursors by default. long story short: I would not trust Oracle with support for these.
Comment 5 pcodes 2016-12-21 01:45:25 UTC
Thanks for the additional info. I will watch for the bot and then test again.
Comment 6 Quality Engineering 2017-01-12 04:02:28 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/99cc66742730
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #269357: Handle oracle timestamp with timezone as "timestamp" and do some cleanup
Comment 7 pcodes 2017-01-13 19:34:28 UTC
Fix looks good. Thanks!