Hi

Also suggested to have the JDBC Driver to be in TOMCAT/lib folder
rather then in the /webapps/application/web-inf/lib






with regards
Karthik



-----Original Message-----
From: VijayKS [mailto:ksvijay...@gmail.com]
Sent: Tuesday, October 13, 2009 1:31 PM
To: users@tomcat.apache.org
Subject: Datasource configuration issue


Hi, I am using Tomcat 5.0.

I have one application "test".
In "test" i created "META-INF" folder and put "context.xml" file.Here is the
content
<context>
<resource name="jdbc/PDBDataSource" scope="Shareable"
type="javax.sql.DataSource">
<resourceparams name="jdbc/PDBDataSource">
<parameter>
 <name>factory</name>
 <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter
<name>url</name>
<value>jdbc:sqlserver://localhost;DatabaseName=test;SelectMethod=cursor;</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
<parameter>
<name>password</name>
<value>sa</value>
</parameter>
<parameter>
</resourceparams>
</resource>
</context>

in WEB-INF\web.xml" file i have the entires
<web-app .... >
<resource-ref>
<res-ref-name>jdbc/PDBDataSource
</res-ref-name>
 <res-type>
    javax.sql.DataSource
  </res-type>
  <res-auth>
    Container
  </res-auth>
</resource-ref>
</web-app>

in my jsp code i have the code
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/PDBDataSource");
Connection conn = ds.getConnection();
conn.close();

I am getting the follwoing error when accessing my page

javax.servlet.ServletException: Cannot create JDBC driver of class '' for
connect URL 'null'

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
        org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
        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)



Help me to resolve this :confused:
--
View this message in context: 
http://www.nabble.com/Datasource-configuration-issue-tp25868686p25868686.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to