You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2007/07/30 22:53:53 UTC

[jira] Resolved: (DERBY-120) Date string returned from SELECT against Network Server is incorrect

     [ https://issues.apache.org/jira/browse/DERBY-120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden resolved DERBY-120.
----------------------------------

    Resolution: Fixed

Resolved by IBM 1.4.2 JRE


> Date string returned from SELECT against Network Server is incorrect
> --------------------------------------------------------------------
>
>                 Key: DERBY-120
>                 URL: https://issues.apache.org/jira/browse/DERBY-120
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>         Environment: Derby Network Server with IBM JRE
>            Reporter: A B
>
> BACKGROUND:
>     System.out.println(java.sql.Date.valueOf("0001-01-01"));
> With a Sun JVM, the above line will print "0001-01-01".  With an IBM JVM, it will print "1-01-01".  The difference is apparently in the implementation of the "toString()" method for the two JVMs.
> PROBLEM:
> Currently, when a query against Network Server returns a date column, the string value for that column is returned using the following line (in DRDAConnThread.java):
>     writer.writeString(((java.sql.Date) val).toString());
> This works fine for Sun JVM, because the toString() method returns "0001-01-01".  However, for IBM JVM, the string "1-01-01" is returned, and that causes the JDBC client to fail, presumably because the client sees it as an invalid date string.
> REPRODUCTION (with JDBC):
> Start the server with an IBM JVM, connect to it using ij, insert the value "0001-01-01" into a table, then select from the table.  The repro here is for JDBC; a failure occurs for ODBC clients, as well.
> [ start server with IBM JRE and create a database ]
> ij> create table t1 (d date);
> 0 rows inserted/updated/deleted
> ij> insert into t1 values ('0001-01-01');
> 1 row inserted/updated/deleted
> ij> select * from t1;
> D
> ----------
> 699-07-22
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: 2941
> java.lang.StringIndexOutOfBoundsException: String index out of range: 2941
>         at java.lang.String.checkBounds(String.java:646)
>         at java.lang.String.<init>(String.java:678)
>         at com.ibm.db2.jcc.a.d.a(d.java:819)
> [ ... ]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.