This week's giveaway is in the Groovy forum.
We're giving away four copies of Groovy Fundamentals video training course and have Ken Kousen on-line!
See this thread for details.
The moose likes Tomcat and the fly likes configure SQL Server 2000 DataSource in Tomcat 5.0.28 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "configure SQL Server 2000 DataSource in Tomcat 5.0.28" Watch "configure SQL Server 2000 DataSource in Tomcat 5.0.28" New topic
Author

configure SQL Server 2000 DataSource in Tomcat 5.0.28

Tong Liu
Greenhorn

Joined: Jan 08, 2006
Posts: 6
I have a database called jspdev, and the username 'bn' and password 'bn' are used to access it.
The structure of the web app which i create is the following:
C:\Tomcat 5.0\webapps\ch13\storetest.jsp
where ch13 is the context root, and i added the following in web.xml

<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/bn</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

and i also add the following in %Tomcat_Home%/conf/Catalina/localhost/manager.xml

<Resource
name="jdbc/bn"
type="javax.sql.DataSource"
password="bn"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
maxIdle="2"
maxWait="5000"
username="bn"
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jspdev"
/>
<ResourceLink global="jdbc/bn" name="jdbc/bn" type="javax.sql.DataSource"/>

after these all done, when i tried to run this app in browser(IE 6+), it gives the following error?

------------------------------------------------------------------------
javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null'
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.storetest_jsp._jspService(storetest_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

-------------------------------------------------------------------------
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
com.jspdev.util.DatabaseConn.getConnection(DatabaseConn.java:16)
com.jspdev.ch13.StoreTest.<init>(StoreTest.java:11)
org.apache.jsp.storetest_jsp._jspService(storetest_jsp.java:49)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Where did you put the JDBC driver?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: configure SQL Server 2000 DataSource in Tomcat 5.0.28