The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

jdbc exception when profiling query

jdbc driver throws an error:   statement.execute("profile select 12.34 from dual;");

the problem appears to be the float result. "select 'foo' from dual" doesn't throw the error.
this is on vertica 6.1.2. stack trace follows and then code snippet.Exception:

thanks for any help. 

kevin wilkinson


java.sql.SQLException: [Vertica]For input string: "12.34"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Long.parseLong(Unknown Source)
        at java.lang.Long.valueOf(Unknown Source)
        at com.vertica.dataengine.VResultSet.getRowCount(Unknown Source)
        at com.vertica.dataengine.VResultSet.fetchChunk(Unknown Source)
        at com.vertica.dataengine.VResultSet.initialize(Unknown Source)
        at com.vertica.dataengine.VQueryExecutor.readExecuteResponse(Unknown Source)
        at com.vertica.dataengine.VQueryExecutor.handleExecuteResponse(Unknown Source)
        at com.vertica.dataengine.VQueryExecutor.execute(Unknown Source)
        at com.vertica.jdbc.SStatement.executeNoParams(Unknown Source)
        at com.vertica.jdbc.SStatement.execute(Unknown Source)
        at bug.Bug.init(Bug.java:76)
        at bug.Bug.main(Bug.java:99)
Caused by: java.lang.NumberFormatException: For input string: "12.34"
        ... 13 more

        private static Properties buildPropertiesObject(boolean autoCommit) {
                        Properties properties = new Properties();
                        properties.put(USER, VERTICA_USR);
                        properties.put(PASSWORD, VERTICA_PWD);
                        properties.put(LOG_PATH, LOG_PATH_VALUE);
                        properties.put(LOG_LEVEL, LOG_LEVEL_VALUE);
                        properties.put(AUTOCOMMIT, autoCommit);

                        return properties;
                }



        public static void init() throws IOException{
        try {
                Class.forName("com.vertica.jdbc.Driver");

                Connection conn = DriverManager.getConnection(DB_URI,
                        buildPropertiesObject(false));

                Statement statement = conn.createStatement();
                statement.execute("profile select 12.34 from dual;");
                ResultSet resultSet = statement.getResultSet();

                System.out.println("Results");
                while(resultSet.next()) {
                        String line = resultSet.getString(1);
                        System.out.println(line);
                }

                resultSet.close();
                statement.close();
                conn.close();

        } catch (SQLException e) {
                        System.out.println("Exception: " + e.toString());
                        e.printStackTrace();
        } catch (Exception e) {
                        System.out.println("Exception: " + e.toString());
                        e.printStackTrace();
        }
        }

        public static void main(String[] args) throws IOException{
                init();
        }






Comments

  • Hi!

    Its problem not with JDBC (same story with ODBC) its a bug in Vertica.
    Vertica reports on PROFILE as non-query, i.e. query that do not returns a result, but actually returns a result and hint.

    As workaround you can enable session profiling and execute query normally.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.