You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by "Christopher M. Logan" <ch...@worlwin.com> on 2023/02/23 12:45:44 UTC

Database response with timestamp shows the String object not value

I'm using NetBeans v14 to connect to Oracle database using JDBC driver 
ojdbc10.jar - connecting to Oracle 19c database. But when resultsets 
contain a timestamp I see oracle.sql.TIMESTAMPTZ in the grid of results 
instead of the value. Is there a JDBC parameter or NetBeans setting to 
not just display a string for each field for the value?
Thank you,
-Christopher

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Database response with timestamp shows the String object not value

Posted by "Christopher M. Logan" <ch...@worlwin.com>.
Hi Sean,
That's what I think is going on behind the scenes for a database 
result-set. My screenshot is from the built-in NetBeans screen showing 
the results of a SQL query. I'm using the Oracle JDBC driver to connect 
to Oracle 19c database, Running a SQL query and getting results. The 
grid is showing one column in the resultset where the datatype is 
timestamp in the database. I'm wondering if there is a JDBC or NetBeans 
switch to translate the timestamp fields correctly. Or... is this a bug?

Thanks for your attention,
-Christopher


On 2023-02-23 16:18, Sean Carrick wrote:
> Christopher,
> 
> What is the code you are using to display the values? From the
> screenshot you provided, it looks like you just passed an object and
> its _toString()_ method is being used to display it.
> 
> -SC
> On 2/23/23 9:28 AM, Christopher M. Logan wrote:
> 
>> Here is a screenshot showing the issue.
>> Thank you
>> -Christopher
>> 
>> ---
>> 
>> On 2023-02-23 07:45, Christopher M. Logan wrote:
>> 
>>> I'm using NetBeans v14 to connect to Oracle database using JDBC
>>> driver
>>> ojdbc10.jar - connecting to Oracle 19c database. But when
>>> resultsets
>>> contain a timestamp I see oracle.sql.TIMESTAMPTZ in the grid of
>>> results instead of the value. Is there a JDBC parameter or
>>> NetBeans
>>> setting to not just display a string for each field for the value?
>>> 
>>> Thank you,
>>> -Christopher
>>> 
>>> 
>> 
> ---------------------------------------------------------------------
>>> 
>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>> 
>>> For further information about the NetBeans mailing lists, visit:
>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>> 
>> 
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>> 
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Database response with timestamp shows the String object not value

Posted by Sean Carrick <se...@pekinsoft.com>.
Christopher,

What is the code you are using to display the values? From the 
screenshot you provided, it looks like you just passed an object and its 
/toString()/ method is being used to display it.

-SC

On 2/23/23 9:28 AM, Christopher M. Logan wrote:
> Here is a screenshot showing the issue.
> Thank you
> -Christopher
>
>
> ---
>
>
> On 2023-02-23 07:45, Christopher M. Logan wrote:
>> I'm using NetBeans v14 to connect to Oracle database using JDBC driver
>> ojdbc10.jar - connecting to Oracle 19c database. But when resultsets
>> contain a timestamp I see oracle.sql.TIMESTAMPTZ in the grid of
>> results instead of the value. Is there a JDBC parameter or NetBeans
>> setting to not just display a string for each field for the value?
>> Thank you,
>> -Christopher
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Re: Database response with timestamp shows the String object not value

Posted by Thomas Kellerer <sh...@gmx.net>.
I think it's a problem in the Oracle JDBC driver.

Most likely NetBeans uses the toString() method to display the column values.
But oracle.sql.TIMESTAMPTZ does not implement toString() and thus it's this typical Java "toString()" representation.

I think the only workaround is to retrieve it as a string using `to_char(crt_ts, 'yyyy-mm-dd hh24:mi:ss')
in your SELECT statement.



Christopher M. Logan schrieb am 23.02.2023 um 16:28:
> Here is a screenshot showing the issue.
> Thank you
> -Christopher
>
>
> ---
>
>
> On 2023-02-23 07:45, Christopher M. Logan wrote:
>> I'm using NetBeans v14 to connect to Oracle database using JDBC driver
>> ojdbc10.jar - connecting to Oracle 19c database. But when resultsets
>> contain a timestamp I see oracle.sql.TIMESTAMPTZ in the grid of
>> results instead of the value. Is there a JDBC parameter or NetBeans
>> setting to not just display a string for each field for the value?
>> Thank you,
>> -Christopher
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Database response with timestamp shows the String object not value

Posted by "Christopher M. Logan" <ch...@worlwin.com>.
Here is a screenshot showing the issue.
Thank you
-Christopher


---


On 2023-02-23 07:45, Christopher M. Logan wrote:
> I'm using NetBeans v14 to connect to Oracle database using JDBC driver
> ojdbc10.jar - connecting to Oracle 19c database. But when resultsets
> contain a timestamp I see oracle.sql.TIMESTAMPTZ in the grid of
> results instead of the value. Is there a JDBC parameter or NetBeans
> setting to not just display a string for each field for the value?
> Thank you,
> -Christopher
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists