Java.sql.sqlexception: Method not supported

  • Today I suddenly received a requirement to add Hive connection mode for deployment in hospital internal system, add JDBC driver and hadoop-common dependency after one operation

    <! -- https://mvnrepository.com/artifact/org.apache.hive/hive-jdbc -->
    <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-jdbc</artifactId>
        <version>1.1.1</version>
        <exclusions>
        <exclusion>
             <groupId>org.eclipse.jetty.aggregate</groupId>
             <artifactId>jetty-all</artifactId>
             </exclusion>
                 <exclusion>
                 <groupId>org.apache.hive</groupId>
                 <artifactId>hive-shims</artifactId>
                 </exclusion>
             </exclusions>
    </dependency>
         <dependency>
         <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-common</artifactId>
         <version>server</version>
    </dependency>
    Copy the code
  • Java.sql.sqlexception: Method not supported

  • After a while of programming for Google (below), I think it might beHiveThe version is incompatible with the JDBC version, and the test environment version is 2.1.0HiveAnd immediately relieved, because the hospitalHiveThe version is 1.1.0, and it is normal to report an error. After changing the JBDC driver version to 2.1.0, I connected to the test environmentHiveIt was working, so I was confident enough to update the hospital’s system.

  • Error: java.sql.sqlexception: Method not supported

    I don’t think the hospital version is not compatible with the driver. When I see the 1.1.0 driver on the official website, I feel that Hive is so garbage. Version driver compatibility is not done.

  • After two hours of fumbling, I always felt something was wrong. After carefully reading the error report, I found that I had neglected the most critical information

    Found that after studying the code to get the data connection is normal, just at the time of query test SQL statement error, the error is HiveStatement setQueryTimeout error, the method is to set up the query timeout

    DBUtil. Query code

    After reading the HiveStatement source code, the case was finally solved

    Originally, the hive-JDBC-1.1.0 driver does not allow you to set the query timeout period. You can use the hive-JDBC-1.1.0 driver normally if you remove the query timeout period. The solution to query from the Internet is to say that the version is incompatible, the need to replace the version, it is misleading, so in the record of the problem at the same time also give and I encountered the same problem a friend to solve the idea.

ps

  • The hive-JdbC-2.1.0 driver can set the query statement timeout period. Therefore, connecting to Hive using the hive-JdbC-2.1.0 driver in the test environment has no problem.