FAQ

cannot connect using impala jdbc

HenryK
Feb 5, 2013 at 5:51 pm
I've been trying to connect to Impala using the new Jdbc driver, however,
I'm running into this...



Connecting...
Exception in thread "main" java.sql.SQLException:
com.cloudera.impala.common.AnalysisException: Syntax error at:
set hive.fetch.output.serde =
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
^
Encountered: IDENTIFIER
Expected: DESCRIBE, SELECT, SHOW, USE, INSERT

at
com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:135)
at com.cloudera.impala.service.Frontend.createExecRequest(Frontend.java:221)
at
com.cloudera.impala.service.JniFrontend.createExecRequest(JniFrontend.java:89)
Caused by: java.lang.Exception: Syntax error
at
com.cloudera.impala.analysis.SqlParser.unrecovered_syntax_error(SqlParser.java:1369)
at java_cup.runtime.lr_parser.parse(lr_parser.java:616)
at
com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:125)
... 2 more

at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:157)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:145)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:165)
at
org.apache.hive.jdbc.HiveConnection.configureConnection(HiveConnection.java:111)
at org.apache.hive.jdbc.HiveConnection.(HiveDriver.java:104)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:243)
at HiveJdbcClient.main(HiveJdbcClient.java:18)


Has anyone run into this problem? Here is the source code driving this...

public class HiveJdbcClient {
private static String driverName = "org.apache.hive.jdbc.HiveDriver";

public static void main(String[] args) throws SQLException {
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
System.out.println("Connecting...");
Connection con =
DriverManager.getConnection("jdbc:hive2://localhost:21050/;auth=noSasl");
System.out.println("Connection Successful");
Statement stmt = con.createStatement();
String sql = "show tables";
System.out.println("Running: " + sql);
ResultSet res = stmt.executeQuery(sql);
while (res.next()) {
System.out.println(res.getString(1));
}
}
}


I'm using MySql for the metastore, and I can connect to Hive via
hive-server2, and Impala via shell.


Thanks!
reply

Search Discussions

3 responses

  • Lenni Kuff at Feb 5, 2013 at 6:43 pm
    Hi Henry,
    Do you happen to have an older Hive version in your classpath as well? It
    looks like you might not be picking up the new Hive Server 2 driver Impala
    is needs.

    Thanks,
    Lenni
    On Tue, Feb 5, 2013 at 9:51 AM, HenryK wrote:

    I've been trying to connect to Impala using the new Jdbc driver, however,
    I'm running into this...



    Connecting...
    Exception in thread "main" java.sql.SQLException:
    com.cloudera.impala.common.AnalysisException: Syntax error at:
    set hive.fetch.output.serde =
    org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
    ^
    Encountered: IDENTIFIER
    Expected: DESCRIBE, SELECT, SHOW, USE, INSERT

    at
    com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:135)
    at
    com.cloudera.impala.service.Frontend.createExecRequest(Frontend.java:221)
    at
    com.cloudera.impala.service.JniFrontend.createExecRequest(JniFrontend.java:89)
    Caused by: java.lang.Exception: Syntax error
    at
    com.cloudera.impala.analysis.SqlParser.unrecovered_syntax_error(SqlParser.java:1369)
    at java_cup.runtime.lr_parser.parse(lr_parser.java:616)
    at
    com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:125)
    ... 2 more

    at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:157)
    at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:145)
    at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:165)
    at
    org.apache.hive.jdbc.HiveConnection.configureConnection(HiveConnection.java:111)
    at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:105)
    at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:104)
    at java.sql.DriverManager.getConnection(DriverManager.java:579)
    at java.sql.DriverManager.getConnection(DriverManager.java:243)
    at HiveJdbcClient.main(HiveJdbcClient.java:18)


    Has anyone run into this problem? Here is the source code driving this...

    public class HiveJdbcClient {
    private static String driverName = "org.apache.hive.jdbc.HiveDriver";

    public static void main(String[] args) throws SQLException {
    try {
    Class.forName(driverName);
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    System.exit(1);
    }
    System.out.println("Connecting...");
    Connection con =
    DriverManager.getConnection("jdbc:hive2://localhost:21050/;auth=noSasl");
    System.out.println("Connection Successful");
    Statement stmt = con.createStatement();
    String sql = "show tables";
    System.out.println("Running: " + sql);
    ResultSet res = stmt.executeQuery(sql);
    while (res.next()) {
    System.out.println(res.getString(1));
    }
    }
    }


    I'm using MySql for the metastore, and I can connect to Hive via
    hive-server2, and Impala via shell.


    Thanks!
  • HenryK at Feb 5, 2013 at 7:22 pm
    The only files in my classpath are the files given by Cloudera
    (https://downloads.cloudera.com/impala-jdbc/impala-jdbc-0.5-1.zip). Am I
    missing something?

    java -cp impala-jdbc-0.5-1/*.jar:. ImpalaJdbcClient

    Note: I ran this on CentOS 5 and 6 and Windows, but ended with the same
    error.
    I've also ran the code using the Hive library with has a slightly different
    version of hive-jdbc, hive-metastore, hive-service. Same error.

    java -cp /usr/lib/hive/lib/*:. ImpalaJdbcClient

    Stumped.

    Thanks,
    Henry
    On Tuesday, February 5, 2013 1:43:27 PM UTC-5, lskuff wrote:

    Hi Henry,
    Do you happen to have an older Hive version in your classpath as well? It
    looks like you might not be picking up the new Hive Server 2 driver Impala
    is needs.

    Thanks,
    Lenni

    On Tue, Feb 5, 2013 at 9:51 AM, HenryK <bak...@gmail.com <javascript:>>wrote:
    I've been trying to connect to Impala using the new Jdbc driver, however,
    I'm running into this...



    Connecting...
    Exception in thread "main" java.sql.SQLException:
    com.cloudera.impala.common.AnalysisException: Syntax error at:
    set hive.fetch.output.serde =
    org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
    ^
    Encountered: IDENTIFIER
    Expected: DESCRIBE, SELECT, SHOW, USE, INSERT

    at
    com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:135)
    at
    com.cloudera.impala.service.Frontend.createExecRequest(Frontend.java:221)
    at
    com.cloudera.impala.service.JniFrontend.createExecRequest(JniFrontend.java:89)
    Caused by: java.lang.Exception: Syntax error
    at
    com.cloudera.impala.analysis.SqlParser.unrecovered_syntax_error(SqlParser.java:1369)
    at java_cup.runtime.lr_parser.parse(lr_parser.java:616)
    at
    com.cloudera.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:125)
    ... 2 more

    at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:157)
    at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:145)
    at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:165)
    at
    org.apache.hive.jdbc.HiveConnection.configureConnection(HiveConnection.java:111)
    at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:105)
    at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:104)
    at java.sql.DriverManager.getConnection(DriverManager.java:579)
    at java.sql.DriverManager.getConnection(DriverManager.java:243)
    at HiveJdbcClient.main(HiveJdbcClient.java:18)


    Has anyone run into this problem? Here is the source code driving this...

    public class HiveJdbcClient {
    private static String driverName = "org.apache.hive.jdbc.HiveDriver";

    public static void main(String[] args) throws SQLException {
    try {
    Class.forName(driverName);
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    System.exit(1);
    }
    System.out.println("Connecting...");
    Connection con =
    DriverManager.getConnection("jdbc:hive2://localhost:21050/;auth=noSasl");
    System.out.println("Connection Successful");
    Statement stmt = con.createStatement();
    String sql = "show tables";
    System.out.println("Running: " + sql);
    ResultSet res = stmt.executeQuery(sql);
    while (res.next()) {
    System.out.println(res.getString(1));
    }
    }
    }


    I'm using MySql for the metastore, and I can connect to Hive via
    hive-server2, and Impala via shell.


    Thanks!
  • HenryK at Feb 5, 2013 at 8:23 pm
    Thanks!
    The new version works.

    link: impala-jdbc-0.5-2.zip<https://downloads.cloudera.com/impala-jdbc/impala-jdbc-0.5-2.zip>
    On Tuesday, February 5, 2013 2:24:48 PM UTC-5, lskuff wrote:

    Hi Henry,
    It looks like there may be a version issue with the JDBC driver that was
    posted. We will have an updated download very soon. We will let you know
    when it's ready.

    Thanks,
    Lenni

    On Tue, Feb 5, 2013 at 11:22 AM, HenryK <bak...@gmail.com <javascript:>>wrote:
    The only files in my classpath are the files given by Cloudera (
    https://downloads.cloudera.com/impala-jdbc/impala-jdbc-0.5-1.zip). Am I
    missing something?

    java -cp impala-jdbc-0.5-1/*.jar:. ImpalaJdbcClient

    Note: I ran this on CentOS 5 and 6 and Windows, but ended with the same
    error.
    I've also ran the code using the Hive library with has a slightly
    different version of hive-jdbc, hive-metastore, hive-service. Same error.

    java -cp /usr/lib/hive/lib/*:. ImpalaJdbcClient

    Stumped.

    Thanks,
    Henry
    On Tuesday, February 5, 2013 1:43:27 PM UTC-5, lskuff wrote:

    Hi Henry,
    Do you happen to have an older Hive version in your classpath as well?
    It looks like you might not be picking up the new Hive Server 2 driver
    Impala is needs.

    Thanks,
    Lenni

    On Tue, Feb 5, 2013 at 9:51 AM, HenryK wrote:

    I've been trying to connect to Impala using the new Jdbc driver,
    however, I'm running into this...



    Connecting...
    Exception in thread "main" java.sql.SQLException:
    com.cloudera.impala.common.**AnalysisException: Syntax error at:
    set hive.fetch.output.serde = org.apache.hadoop.hive.serde2.**
    lazy.LazySimpleSerDe
    ^
    Encountered: IDENTIFIER
    Expected: DESCRIBE, SELECT, SHOW, USE, INSERT

    at com.cloudera.impala.analysis.**AnalysisContext.analyze(**
    AnalysisContext.java:135)
    at com.cloudera.impala.service.**Frontend.createExecRequest(**
    Frontend.java:221)
    at com.cloudera.impala.service.**JniFrontend.createExecRequest(**
    JniFrontend.java:89)
    Caused by: java.lang.Exception: Syntax error
    at com.cloudera.impala.analysis.**SqlParser.unrecovered_syntax_**
    error(SqlParser.java:1369)
    at java_cup.runtime.lr_parser.**parse(lr_parser.java:616)
    at com.cloudera.impala.analysis.**AnalysisContext.analyze(**
    AnalysisContext.java:125)
    ... 2 more

    at org.apache.hive.jdbc.Utils.**verifySuccess(Utils.java:157)
    at org.apache.hive.jdbc.Utils.**verifySuccessWithInfo(Utils.**
    java:145)
    at org.apache.hive.jdbc.**HiveStatement.execute(**
    HiveStatement.java:165)
    at org.apache.hive.jdbc.**HiveConnection.**configureConnection(**
    HiveConnection.java:111)
    at org.apache.hive.jdbc.**HiveConnection.<init>(**
    HiveConnection.java:105)
    at org.apache.hive.jdbc.**HiveDriver.connect(HiveDriver.**java:104)
    at java.sql.DriverManager.**getConnection(DriverManager.**java:579)
    at java.sql.DriverManager.**getConnection(DriverManager.**java:243)
    at HiveJdbcClient.main(**HiveJdbcClient.java:18)


    Has anyone run into this problem? Here is the source code driving
    this...

    public class HiveJdbcClient {
    private static String driverName = "org.apache.hive.jdbc.**
    HiveDriver";

    public static void main(String[] args) throws SQLException {
    try {
    Class.forName(driverName);
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    System.exit(1);
    }
    System.out.println("**Connecting...");
    Connection con = DriverManager.getConnection("**
    jdbc:hive2://localhost:21050/;**auth=noSasl");
    System.out.println("Connection Successful");
    Statement stmt = con.createStatement();
    String sql = "show tables";
    System.out.println("Running: " + sql);
    ResultSet res = stmt.executeQuery(sql);
    while (res.next()) {
    System.out.println(res.**getString(1));
    }
    }
    }


    I'm using MySql for the metastore, and I can connect to Hive via
    hive-server2, and Impala via shell.


    Thanks!

Related Discussions

Discussion Navigation
viewthread | post

2 users in discussion

HenryK: 3 posts Lenni Kuff: 1 post