Re: Timestamp Conversion Issue
Posted by: Mark Matthews
Date: January 06, 2005 02:35PM

Kris Younger wrote:
> Okay - Now I am certain I am using 3.1.6. I even
> just dropped the database and reloaded the
> schema.
> Then I used the app to create a record in an
> "Accounts" table... it has a Date oobject that
> gets created to timestamp the
> event.
> It stores it into the mysqld.
> Command line reports:
> mysql> select * from Accounts;
> +------+-------+--------------+---------+------+--
> -------------------+---------------+--------------
> --+----------------+-------------+--------------+-
> -----------+
> | acId | acDel | acName | acEmail | acPw |
> acCreate | acLastEventId |
> acCheckContact | acCheckAddress | acCheckCity |
> acCheckState | acCheckZip |
> +------+-------+--------------+---------+------+--
> -------------------+---------------+--------------
> --+----------------+-------------+--------------+-
> -----------+
> | 1 | 0 | 82North Test | k | k |
> 2005-01-05 00:00:00 | NULL | Kris Younger
> | 123 Main St. | Foo | Bar
> | 12345 |
> +------+-------+--------------+---------+------+--
> -------------------+---------------+--------------
> --+----------------+-------------+--------------+-
> -----------+
> 1 row in set (0.00 sec)
>
> but when I fetch that rwo to edit it within my app
> - I get, in my browser, the following... NOTA
> BENE: at the spot where I have <<weird
> character here>>, there is, displayed in the
> browser, a character that looks like small dotted
> rectangle..... (I kid you not) (I'm running
> firefox 1.0 on linux in this case. although that
> should not matter.)
>
> Exception Details: java.sql.SQLException
> Cannot convert value '2005-01-05
> 00:00:00.<<weird character here>>'
> from column 6 to TIMESTAMP.
>
> Possible Source of Error:
> Class Name: com.mysql.jdbc.ResultSet
> File Name: ResultSet.java
> Method Name: getTimestampFromString
> Line Number: 6369
>
> Source not available. Information regarding the
> location of the exception can be identified using
> the exception stack trace below.
>
> Stack Trace:
>
> com.mysql.jdbc.ResultSet.getTimestampFromString(Re
> sultSet.java:6369)
> com.mysql.jdbc.ResultSet.getTimestampInternal(Resu
> ltSet.java:6394)
> com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.ja
> va:2268)
> com.mysql.jdbc.ResultSet.getObject(ResultSet.java:
> 1808)
> com.sun.sql.rowset.JdbcRowSetXImpl.handleOnInsertR
> owGet(JdbcRowSetXImpl.java:2372)
> com.sun.sql.rowset.JdbcRowSetXImpl.handleOnInsertR
> owGet(JdbcRowSetXImpl.java:2141)
> com.sun.sql.rowset.JdbcRowSetXImpl.getObject(JdbcR
> owSetXImpl.java:1021)
> com.sun.sql.rowset.JdbcRowSetXImpl.getObject(JdbcR
> owSetXImpl.java:1025)
> com.sun.jsfcl.data.ResultSetPropertyResolver$RowDa
> ta.getData(ResultSetPropertyResolver.java:176)
> com.sun.jsfcl.data.ResultSetPropertyResolver.getVa
> lue(ResultSetPropertyResolver.java:59)
> com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySu
> ffix.java:167)
> com.sun.faces.el.impl.ComplexValue.evaluate(Comple
> xValue.java:151)
> com.sun.faces.el.impl.ExpressionEvaluatorImpl.eval
> uate(ExpressionEvaluatorImpl.java:243)
> com.sun.faces.el.ValueBindingImpl.getValue(ValueBi
> ndingImpl.java:173)
> com.sun.faces.el.ValueBindingImpl.getValue(ValueBi
> ndingImpl.java:154)
> javax.faces.component.UIOutput.getValue(UIOutput.j
> ava:147)
> com.sun.faces.renderkit.html_basic.HtmlBasicInputR
> enderer.getValue(HtmlBasicInputRenderer.java:82)
> com.sun.faces.renderkit.html_basic.HtmlBasicRender
> er.getCurrentValue(HtmlBasicRenderer.java:191)
> com.sun.faces.renderkit.html_basic.HtmlBasicRender
> er.encodeEnd(HtmlBasicRenderer.java:169)
> javax.faces.component.UIComponentBase.encodeEnd(UI
> ComponentBase.java:720)
> javax.faces.webapp.UIComponentTag.encodeEnd(UIComp
> onentTag.java:623)
> javax.faces.webapp.UIComponentTag.doEndTag(UICompo
> nentTag.java:546)
> com.sun.faces.taglib.html_basic.OutputTextTag.doEn
> dTag(OutputTextTag.java:173)
> org.apache.jsp.AccountsEdit_jsp._jspx_meth_h_outpu
> tText_14(AccountsEdit_jsp.java:733)
> org.apache.jsp.AccountsEdit_jsp._jspx_meth_h_form_
> 0(AccountsEdit_jsp.java:190)
> org.apache.jsp.AccountsEdit_jsp._jspx_meth_f_view_
> 0(AccountsEdit_jsp.java:133)
> org.apache.jsp.AccountsEdit_jsp._jspService(Accoun
> tsEdit_jsp.java:91)
> org.apache.jasper.runtime.HttpJspBase.service(Http
> JspBase.java:102)
> javax.servlet.http.HttpServlet.service(HttpServlet
> .java:861)
> org.apache.jasper.servlet.JspServletWrapper.servic
> e(JspServletWrapper.java:282)
> org.apache.jasper.servlet.JspServlet.serviceJspFil
> e(JspServlet.java:263)
> org.apache.jasper.servlet.JspServlet.service(JspSe
> rvlet.java:210)
> javax.servlet.http.HttpServlet.service(HttpServlet
> .java:861)

Kris,

Turns out this is a bug in the JDBC driver (sorry), that only manifests itself when you are (1) using Server-side prepared statements _and_ updatable result sets at the same time. I went ahead and filed this for you (see http://bugs.mysql.com/bug.php?id=7715), and am checking in the fix as I write this. This fix should make the nightly build of C/J 3.1 which you can grab from http://downloads.mysql.com/snapshots.php after 00:00 GMT tomorrow.

I do have one question though, is the rowset code _always_ asking for updatable result sets? That's a pretty large performance issue if they never actually get updated :(

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
January 05, 2005 07:35PM
Re: Timestamp Conversion Issue
January 06, 2005 02:35PM
January 07, 2005 09:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.