You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Navis (JIRA)" <ji...@apache.org> on 2013/06/24 07:59:22 UTC

[jira] [Updated] (HIVE-4573) JDBC Compliance getTables

     [ https://issues.apache.org/jira/browse/HIVE-4573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Navis updated HIVE-4573:
------------------------

    Description: 
The getTables jdbc function no longer returns information when using normal JDBC table types like TABLE or VIEW. You must now use a more specific type such as MANAGED_TABLE or VIRTUAL_VIEW. An example application that will fail to return results against 0.10 is below, works without issue in 0.9. In my 0.10 test I used HS2. 

{code}

import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
import org.apache.hive.jdbc.HiveDriver;
import java.sql.DatabaseMetaData;

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

  /**
 * @param args
 * @throws SQLException
   */
  public static void main(String[] args) throws SQLException {
      try {
      Class.forName(driverName);
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.exit(1);
    }
    Connection con = DriverManager.getConnection("jdbc:hive2://hostname:10000/default");
    DatabaseMetaData dbmd = con.getMetaData();
    String[] types = {"TABLE"};
    ResultSet rs = dbmd.getTables(null, null, "%", types);
      while (rs.next()) {
        System.out.println(rs.getString("TABLE_NAME"));
      }
    }
  }
}
{code}

  was:
The getTables jdbc function no longer returns information when using normal JDBC table types like TABLE or VIEW. You must now use a more specific type such as MANAGED_TABLE or VIRTUAL_VIEW. An example application that will fail to return results against 0.10 is below, works without issue in 0.9. In my 0.10 test I used HS2. 

import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
import org.apache.hive.jdbc.HiveDriver;
import java.sql.DatabaseMetaData;

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

  /**
 * @param args
 * @throws SQLException
   */
  public static void main(String[] args) throws SQLException {
      try {
      Class.forName(driverName);
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.exit(1);
    }
    Connection con = DriverManager.getConnection("jdbc:hive2://hostname:10000/default");
    DatabaseMetaData dbmd = con.getMetaData();
    String[] types = {"TABLE"};
    ResultSet rs = dbmd.getTables(null, null, "%", types);
      while (rs.next()) {
        System.out.println(rs.getString("TABLE_NAME"));
      }
    }
  }


    
> JDBC Compliance getTables
> -------------------------
>
>                 Key: HIVE-4573
>                 URL: https://issues.apache.org/jira/browse/HIVE-4573
>             Project: Hive
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 0.10.0
>            Reporter: Johndee Burks
>            Priority: Minor
>
> The getTables jdbc function no longer returns information when using normal JDBC table types like TABLE or VIEW. You must now use a more specific type such as MANAGED_TABLE or VIRTUAL_VIEW. An example application that will fail to return results against 0.10 is below, works without issue in 0.9. In my 0.10 test I used HS2. 
> {code}
> import java.sql.SQLException;
> import java.sql.Connection;
> import java.sql.ResultSet;
> import java.sql.Statement;
> import java.sql.DriverManager;
> import org.apache.hive.jdbc.HiveDriver;
> import java.sql.DatabaseMetaData;
> public class TestGet {
>   private static String driverName = "org.apache.hive.jdbc.HiveDriver";
>   /**
>  * @param args
>  * @throws SQLException
>    */
>   public static void main(String[] args) throws SQLException {
>       try {
>       Class.forName(driverName);
>     } catch (ClassNotFoundException e) {
>       // TODO Auto-generated catch block
>       e.printStackTrace();
>       System.exit(1);
>     }
>     Connection con = DriverManager.getConnection("jdbc:hive2://hostname:10000/default");
>     DatabaseMetaData dbmd = con.getMetaData();
>     String[] types = {"TABLE"};
>     ResultSet rs = dbmd.getTables(null, null, "%", types);
>       while (rs.next()) {
>         System.out.println(rs.getString("TABLE_NAME"));
>       }
>     }
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira