Support Questions

Find answers, ask questions, and share your expertise

how to connect with hive database using JSP ?

avatar

Hi,

I'm just trying to connect my JSP program to retrieve data from hive database.

So my jsp code for that is as follows,

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ HTTP Status 500 - The absolute uri: http://java.sun.com/jstl/core 
cannot be resolved in either web.xml or the jar files deployed with this
 application
page import="javax.servlet.http.*,javax.servlet.*" %>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="sql" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SELECT OPERATION</title>
</head>
<body>
<sql:setDataSource var="snapshot" driver="org.apache.hive.jdbc.HiveDriver"  url="jdbc:hive2://localhost:10000/default"  user="root"  password="hadoop"/>
<sql:query dataSource="${snapshot}" var="result">SELECT * from test;</sql:query> 
<table border="1" width="100%">
<tr>  
<th>S.No</th> 
<th>Name</th>
</tr>
<c:forEach var="row" items="${result.rows}">
<tr>  
<td>
<c:out value="${row.sno}"/>
</td> 
<td>
<c:out value="${row.name}"/>
</td>
</tr>
</c:forEach>
</table>
</body></html>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
</web-app>

POM.xml :

<?xml version="1.0" encoding="UTF-8"?>
<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

I have created a test table in hive database with the following schema (sno int,name String);

Server -Tomcat v7

The error which am getting is given below. Please provide me a solution to connect with hive server 2 using JSP

The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
1 ACCEPTED SOLUTION

avatar
Master Guru

That does not sound like an Hive error at all but some library dependencies you have missing.

http://stackoverflow.com/questions/4928271/how-to-install-jstl-the-absolute-uri-http-java-sun-com-js...

View solution in original post

3 REPLIES 3

avatar
Master Guru

That does not sound like an Hive error at all but some library dependencies you have missing.

http://stackoverflow.com/questions/4928271/how-to-install-jstl-the-absolute-uri-http-java-sun-com-js...

avatar

Yes, i have added libraries in both WEB-INF/lib and in WEB-INF/classes and now I can able to access my hive tables in JSP pages.

avatar
Master Mentor

@priya dharshini if Benjamin's answer help, please accept it.