java.lang.IllegalArgumentException: Timestamp

2006-02-01
2013-04-25
  • Rahul Patil
    Rahul Patil
    2006-02-01

    I am getting the following exceptions while trying to use P6Spy for your application.
    Please suggest.
    Its such a great tool and I need to use it for database profiling of our application.

    java.sql.SQLException: JZ009: Error encountered in conversion.  Error message: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:526)
    at com.sybase.jdbc2.jdbc.Convert.objectToTimestamp(Convert.java:585)
    at om.sybase.jdbc2.jdbc.Convert.objectToDateObject(Convert.java:703)
    at com.sybase.jdbc2.tds.TdsJdbcInputStream.getDateObject(TdsJdbcInputStream.java:802)
    at com.sybase.jdbc2.jdbc.SybResultSet.getTimestamp(SybResultSet.java:291)
    at com.sybase.jdbc2.jdbc.SybResultSet.getTimestamp(SybResultSet.java:401)
    at com.p6spy.engine.spy.P6ResultSet.getTimestamp(P6ResultSet.java:330)
    at com.p6spy.engine.spy.P6ResultSet.getTimestamp(P6ResultSet.java:338)

    java.sql.SQLException: JZ009: Error encountered in conversion.  Error message: java.lang.NumberFormatException: For input string: "AL"
    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:526)
    at com.sybase.jdbc2.tds.TdsJdbcInputStream.getLong(TdsJdbcInputStream.java:1157)
    at com.sybase.jdbc2.jdbc.SybResultSet.getLong(SybResultSet.java:246)
    at com.sybase.jdbc2.jdbc.SybResultSet.getLong(SybResultSet.java:343)
    at com.p6spy.engine.spy.P6ResultSet.getLong(P6ResultSet.java:188)
    at com.p6spy.engine.spy.P6ResultSet.getLong(P6ResultSet.java:184)

     
    • Rahul Patil
      Rahul Patil
      2006-02-01

      Problem solved. The p6spy library needs to be patched.
      The P6ResultSet.java is using method overloading which causes this kind of exceptions.
      For instance consider the method:

      public Clob getClob(int p0) throws SQLException {
              return getClob(passthru.getMetaData().getColumnName(p0));
      }

      Now, consider the following query which uses the isNull clause, this doesn't really result into a resultset which has columnName for the corresponding columns.
      So the above method fails to retrieve the proper data based on the ColumnBame.
      It should be modified as:
      public Clob getClob(int p0) throws SQLException {
              return passthru. getClob(p0);
      }