my dog learned polymorphism*
The moose likes IDEs, Version Control and other tools and the fly likes Error:Unable to get connection, DataSource invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Error:Unable to get connection, DataSource invalid" Watch "Error:Unable to get connection, DataSource invalid" New topic
Author

Error:Unable to get connection, DataSource invalid

ahalya priya
Greenhorn

Joined: Jan 21, 2009
Posts: 10
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

Joined: Jan 10, 2002
Posts: 61103
    
  66

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ahalya priya
Greenhorn

Joined: Jan 21, 2009
Posts: 10
This issue is related to jsp, because when i ran the jsp page i am getting that problem. That's why i posted here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error:Unable to get connection, DataSource invalid