Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- //create connection
- String user = "wilianto";
- String pass = "";
- String driver = "org.apache.hive.jdbc.HiveDriver";
- String url = "jdbc:hive2://localhost:10000/default";
- Class.forName(driver).newInstance();
- Connection con = DriverManager.getConnection(url, user, pass);
- if(con == null){
- out.println("Not connected!");
- }else{
- out.println("Connected!");
- }
- //do query
- Statement statement = con.createStatement();
- ResultSet rs = statement.executeQuery("SELECT * FROM destination_trends_summary");
- while(rs.next()){
- out.println(rs.getString("destination") + ", " + rs.getString("post_date") + ", " + rs.getString("qty") + "<br>");
- }
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement