• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error:Unable to get connection, DataSource invalid

 
ahalya priya
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using SQL Server 2008,Tomcat,Eclipse

I am able to connect from Datasource Explorer in the eclipse.

Here is my code

<sql:setDataSource var="datasource"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
user="jspuser"
password="jspuser"
url="jdbc:sqlserver://localhost:1433;databasename=bookdetails;"
/>

<sql:query var="books" dataSource="${datasource}">
SELECT * FROM book
</sql:query>


<html>
<head>
<title>A First JSP Database</title>
</head>
<body>
<c:forEach items="${books.rows}" var="row"> </c:forEach>
idtitleprice
<cut value="${row.id}" /> <cut value="${row.title}" /> <cut value="${row.price}" />

</body>
</html>


My error is

org.apache.jasper.JasperException: Unable to get connection, DataSource invalid
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

javax.servlet.ServletException: Unable to get connection, DataSource invalid
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:100)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:295)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:185)
org.apache.jsp.bookList_jsp._jspx_meth_sql_005fquery_005f0(bookList_jsp.java:141)
org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:74)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


Please help me.
I am spending hours and hours to find out problem.


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on JSP. For more information, please read this.

This post has been moved to a more appropriate forum.
 
ahalya priya
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This issue is related to jsp, because when i ran the jsp page i am getting that problem. That's why i posted here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic