Re: Datasource configuration issue

2009-10-13 Thread Mark Thomas
VijayKS wrote:
 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
That should be Context

 resource name=jdbc/PDBDataSource scope=Shareable
That should be Resource ...

Case matters. Check your config against the docs.

Mark




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



RE: Datasource configuration issue

2009-10-13 Thread Karthik Nanjangude
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
 namefactory/name
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
nameurl/name
valuejdbc:sqlserver://localhost;DatabaseName=test;SelectMethod=cursor;/value
/parameter
parameter
namedriverClassName/name
valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value
/parameter
parameter
nameusername/name
valuesa/value
/parameter
parameter
namepassword/name
valuesa/value
/parameter
parameter
/resourceparams
/resource
/context

in WEB-INF\web.xml file i have the entires
web-app  
resource-ref
res-ref-namejdbc/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



Re: Datasource configuration issue

2009-10-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Karthik,

On 10/13/2009 6:18 AM, Karthik Nanjangude wrote:
 Also suggested to have the JDBC Driver to be in TOMCAT/lib folder
 rather then in the /webapps/application/web-inf/lib

I believe this is a /requirement/, not just good practice.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrU/CsACgkQ9CaO5/Lv0PDVnACfVFx4Wh4Ep03X94xBMuDNvQp3
z/0AoIwEiZP7kakdbb2Q6EzG4c4CPIKP
=+Zq+
-END PGP SIGNATURE-

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