Null Pointer Exception while running report

Ashok
2006-12-28
2013-06-03
  • Ashok
    Ashok
    2006-12-28

    I'm trying to run a report by selecting few fields from the MySQL database table, that throws a Null Pointer Exception. Looking at the log the select query SQL statement is
    Thu Dec 28 14:03:42 PST 2006 TRACE:       --> StringUtils.java:1189 com.mysql.jd
    bc.StringUtils.startsWithIgnoreCaseAndWs("select turbine_user."FIRST_NAME", turb
    ine_user."LAST_NAME" from turbine_user", "SET", 0)

    Not sure if the above SQL statement is run as such and qutoes around the FIRST_NAME is causing the trouble.

    mysql> select turbine_user."FIRST_NAME", turbine_user."LAST_NAME" from turbine_u
    ser;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near '"FIRS
    T_NAME", turbine_user."LAST_NAME" from turbine_user' at line 1

    mysql> select turbine_user.FIRST_NAME, turbine_user.LAST_NAME from turbine_user;

    +-------------------+-------------------+
    | FIRST_NAME        | LAST_NAME         |
    +-------------------+-------------------+
    | webadmin_fistname | webadmin_lastname |
    | Test              | User              |
    | Test1 Company     | User              |
    | Test2             | User              |
    +-------------------+-------------------+
    4 rows in set (0.00 sec)

    Stack trace
    DataVision v1.0.0
    java.lang.NullPointerException
    java.lang.NullPointerException
            at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:578)
            at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:516)
            at com.mysql.jdbc.PreparedStatement.toString(PreparedStatement.java:3758
    )
            at java.lang.String.valueOf(String.java:2615)
            at java.lang.StringBuffer.append(StringBuffer.java:220)
            at com.mysql.jdbc.trace.Tracer.printParameters(Tracer.aj:240)
            at com.mysql.jdbc.trace.Tracer.printEntering(Tracer.aj:167)
            at com.mysql.jdbc.trace.Tracer.entry(Tracer.aj:126)
            at com.mysql.jdbc.trace.Tracer.ajc$before$com_mysql_jdbc_trace_Tracer$1$
    f51c62b8(Tracer.aj:45)
            at com.mysql.jdbc.Connection.registerStatement(Connection.java)
            at com.mysql.jdbc.Statement.<init>(Statement.java:267)
            at com.mysql.jdbc.PreparedStatement.<init>(PreparedStatement.java:435)
            at com.mysql.jdbc.ServerPreparedStatement.asSql(ServerPreparedStatement.
    java:360)
            at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:516)
            at com.mysql.jdbc.ServerPreparedStatement.toString(ServerPreparedStateme
    nt.java:2433)
            at java.lang.String.valueOf(String.java:2615)
            at java.lang.StringBuffer.append(StringBuffer.java:220)
            at com.mysql.jdbc.trace.Tracer.printParameters(Tracer.aj:240)
            at com.mysql.jdbc.trace.Tracer.printEntering(Tracer.aj:167)
            at com.mysql.jdbc.trace.Tracer.entry(Tracer.aj:126)
            at com.mysql.jdbc.trace.Tracer.ajc$before$com_mysql_jdbc_trace_Tracer$1$
    f51c62b8(Tracer.aj:45)
            at com.mysql.jdbc.Connection.registerStatement(Connection.java)
            at com.mysql.jdbc.Statement.<init>(Statement.java:267)
            at com.mysql.jdbc.PreparedStatement.<init>(PreparedStatement.java:417)
            at com.mysql.jdbc.ServerPreparedStatement.<init>(ServerPreparedStatement
    .java:290)
            at com.mysql.jdbc.Connection.prepareStatement(Connection.java:4656)
            at com.mysql.jdbc.Connection.prepareStatement(Connection.java:4573)
            at jimm.datavision.source.sql.ResultSetRow.<init>(Unknown Source)
            at jimm.datavision.source.sql.Database.execute(Unknown Source)
            at jimm.datavision.Report.runReport(Unknown Source)
            at jimm.datavision.Report$9.run(Unknown Source)
            at java.lang.Thread.run(Thread.java:595)

    I'm running with JDK 1.5, hope thats not an issue here. Can you please help to overcome this issue.

    Thanks.
    Ashok

     
    • Jim Menard
      Jim Menard
      2006-12-29

      From the manual: "Normally, database table and column names are quoted when necessary (when the case of the name does not match the case the JDBC driver uses when it performs a query). Using the -q flag turns off this quoting, except for names that contain spaces which are always quoted."

      Unfortunately, DataVision doesn't use backquotes ("`") as it should with MySQL.

       
    • Ashok
      Ashok
      2006-12-29

      I tried with the -q option, doesn't help. Same Null Pointer Exception.