[Backlogmanager] [FIWARE-JIRA] (HELP-9482) [fiware-stackoverflow] Accesing Cosmos data with Hive from Javascript

Fernando Lopez (JIRA) jira-help-desk at jira.fiware.org
Thu Jun 8 14:46:00 CEST 2017


     [ https://jira.fiware.org/browse/HELP-9482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fernando Lopez deleted HELP-9482:
---------------------------------


> [fiware-stackoverflow] Accesing Cosmos data with Hive from Javascript
> ---------------------------------------------------------------------
>
>                 Key: HELP-9482
>                 URL: https://jira.fiware.org/browse/HELP-9482
>             Project: Help-Desk
>          Issue Type: Monitor
>            Reporter: Backlog Manager
>              Labels: fiware, javascript
>
> Created question in FIWARE Q/A platform on 14-10-2014 at 18:10
> {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/26366059/accesing-cosmos-data-with-hive-from-javascript
> +Question:+
> Accesing Cosmos data with Hive from Javascript
> +Description:+
> I'm triying to access data stored in Cosmos by using javascript to create a web interface. I know there's a java code available to make query's with Hive. That code is shown below:
>     private Connection getConnection(
>       String ip, String port, String user, String password) {
>    try {
>       // dynamically load the Hive JDBC driver
>       Class.forName("org.apache.hadoop.hive.jdbc.HiveDriver");
>    } catch (ClassNotFoundException e) {
>       System.out.println(e.getMessage());
>       return null;
>    } // try catch
>    try {
>       // return a connection based on the Hive JDBC driver, default DB
>       return DriverManager.getConnection("jdbc:hive://" + ip + ":" +
>          port + "/default?user=" + user + "&password=" + password);
>    } catch (SQLException e) {
>       System.out.println(e.getMessage());
>       return null;
>    } // try catch
> } // getConnection
>     private void doQuery() {
>    try {
>       // from here on, everything is SQL!
>       Statement stmt = con.createStatement();
>       ResultSet res = stmt.executeQuery("select column1,column2," +
>          "otherColumns from mytable where column1='whatever' and " +
>          "columns2 like '%whatever%'");
>       // iterate on the result
>       while (res.next()) {
>          String column1 = res.getString(1);
>          Integer column2 = res.getInteger(2);
>          // whatever you want to do with this row, here
>       } // while
>       // close everything
>       res.close(); stmt.close(); con.close();
>    } catch (SQLException ex) {
>       System.exit(0);
>    } // try catch
> } // doQuery
> I need to know how to implement that code in javascript, I know it's possible but I don't know how.
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.4.1#64016)


More information about the Backlogmanager mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy