Should I put it in tomcat\webapps\ROOT\WEB-INF\web.xml? (my jsp file using
Database connection is in ROOT/zuo), but in this web.xml, I already have:
<resource-ref>
<description>SQL Server DataSource</description>
<res-ref-name>jdbc/dbName</res-ref-name>
<res-type>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Following the examples on the web, I wrote the java code in JSP:
envCtx = (Context) initCtx.lookup("java:comp/env");
ds = (ConnectionPoolDataSource ) envCtx.lookup("jdbc/dbName"); // <---
error occurs here
if (ds != null){
if(ds instanceof com.microsoft.jdbcx.sqlserver.SQLServerDataSource){
SQLServerDataSource temp =
(com.microsoft.jdbcx.sqlserver.SQLServerDataSource)ds;
con = temp.getPooledConnection(user,pswd).getConnection();
now the error occurs at envCtx.lookup. the error is: Cannot create resource
instance
Thanks.
-----Original Message-----
From: Parsons Technical Services [mailto:[EMAIL PROTECTED]
Sent: Friday, April 30, 2004 4:42 PM
To: Tomcat Users List
Subject: Re: Please help on my DB pool problem --- I followed the
struction on the web
Daxin,
When you put the dbcp in the GlobalResource did you put a link to the
resource in the context?
Place this in the context for each app that will use the database connection
pool.
<ResourceLink name="jdbc/dbName" global="jdbc/dbName"
type="com.microsoft.jdbcx.sqlserver.SQLServerDataSource"/>
In the last email that I sent in addition to the link, was a complete
working set of configurations. Each piece of the configuration was labeled
as to where to add it. Remove all your old attempts and start from the
beginning. If you made a backup of your original files use them. Then put in
each piece and modify with your information.
Let us know.
Doug
----- Original Message -----
From: "Daxin Zuo" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, April 30, 2004 2:05 PM
Subject: RE: Please help on my DB pool problem --- I followed the struction
on the web
> 1)I added it and still get the same error. the error occurred at con =
> ds.getConnection(); error:Cannot create JDBC driver of class '' for
connect
> URL 'null'
> 2) I also followed the way in the link that forwarded by Persons Technical
> Services. In that configuration, it used com.microsoft.jdbcx.sqlserver. If
I
> still use javax.sql.DataSource in my JSP file, I got the same error. If I
> use com.microsoft.jdbcx.sqlserver in my JSP file, the error occurred at
> lookup the source.
> But I did not use <context>. I moved the DB pool context into
> <GlobalNamingResources>. The block is for JNDI global name.
> 3) I also add the database name as Eric indicated. It does not effect.
> 4) if I remove the db pool configuration in server.xml( web.xml still has
> the configuration), I got the same error.
>
> 5) if I remove the db pool configuration in
> tomcat\webapps\ROOT\WEB-INF\web.xml, the error is Name jdbc is not bound
in
> this Context.
>
> My jsp file is in tomcat\webapps\ROOT\zuo, and in tomcat\webapps\ROOT,
same
> error.
>
> It seems the configuration in tomcat/conf/server.xml is incorrect. Should
I
> write some thing in different file?
> If I should write the text in <context> (right now no this block in
> server.xml), how to set the path and docBase if my file is in
> tomcat\webapps\ROOT\zuo\. But I think put the configuration text in
> <GlobalNamingResources> is the right place.
> I am using Apache 2.0.49+Tomcat 5.0.19+windows 2000/Unix/Linux+MS SQL
> server 2000 + sp4, is there another better jdbc driver with the
> configuration tricks?
> Please help.
> Thanks.
>
> -----Original Message-----
> From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 30, 2004 12:22 AM
> To: Tomcat Users List
> Subject: RE: Please help on my DB pool problem --- I followed the
> struction on the web
>
>
> I didn't see your factory in your server.xml
> <ResourceParams name="jdbc/DBName">
>
> Try adding :
> <parameter>
> <name>factory</name>
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
>
>
>
> -----Message d'origine-----
> De : Daxin Zuo [mailto:[EMAIL PROTECTED]
> Envoy� : vendredi 30 avril 2004 00:55
> � : Tomcat Users List
> Objet : Please help on my DB pool problem --- I followed the struction
> on the web
>
>
> I have problem in using connection pool. I use Apache 2.0.49, Tomcat
> 5.0.19, windows 2000 server, MS SQL server 2000 + sp4
> On the browser I see the
> error: Cannot create JDBC driver of class '' for connect URL 'null'
> on Tomcat monitor, I see the message:
> Apr 29, 2004 3:36:25 PM org.apache.jk.common.HandlerRequest decodeRequest
> WARNING: Error registering request
>
> The url and driver class is not find. bellow is my configuration. Please
> forward instruction. Thanks a
> lot.
>
> 1) I copy the three jar files to \common\lib in %catalina_home% from
> C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC
>
> 2) MY webapps/ROOT/web-inf/web.xml is:
> ...
> <resource-ref>
> <description> JDBC Driver:
> com.microsoft.jdbc.sqlserver.SQLServerDriver</description>
> <res-ref-name>jdbc/DBName</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> </web-app>
>
> 3) my JSP file is in /ROOT, it contains code:
> <%@ page import="java.sql.*" %>
> <%@ page import="java.lang.reflect.*" %>
> <%@ page import="java.io.*" %>
> <%@ page import="javax.naming.*" %>
> ......
> <%.....
> Connection con = null;
> PreparedStatement pStateSearch=null;
> Context initCtx;
> Context envCtx;
> javax.sql.DataSource ds;
> initCtx = new InitialContext();
> envCtx = (Context) initCtx.lookup("java:comp/env");
> ds = (DataSource)envCtx.lookup("jdbc/DBName");
> con = ds.getConnection();
> ....%>
>
> 4) my apache2/conf/server.xml is
> <Resource name="jdbc/DBName" auth="container"
> type="javax.sql.DataSource"/>
> <ResourceParams name="jdbc/DBName">
> <!-- Maximum number of dB connections in pool. Set to 0 for no limit.-->
> <parameter>
> <name>maxActive</name>
> <value>8</value>
> </parameter>
>
> <!-- Maximum number of idle dB connections to retain in pool.Set to 0 for
> no limit.-->
> <parameter>
> <name>maxIdle</name>
> <value>4</value>
> </parameter>
>
> <!-- Maximum time to wait for a dB connection to become available
> in ms, in this example 10 seconds. An Exception is thrown if
> this timeout is exceeded. Set to -1 to wait indefinitely.
> -->
> <parameter>
> <name>maxWait</name>
> <value>10000</value>
> </parameter>
>
> <!--parameter>
> <name>removeAbandoned</name>
> <value>true</value>
> </parameter>
>
> <parameter>
> <name>removeAbandonedTimeout</name>
> <value>60</value>
> </parameter-->
>
>
> <!-- MS Sql Server dB username and password for dB connections-->
> <parameter>
> <name>user</name>
> <value>dzuo</value>
> </parameter>
>
> <parameter>
> <name>password</name>
> <value>dzuo</value>
> </parameter>
>
> <!-- Class name for MS Sql Server JDBC driver
> -->
> <parameter>
> <name>driverClassName</name>
> <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
> </parameter>
>
> <!-- The JDBC connection url for connecting to MS Sql Server dB.-->
> <parameter>
> <name>url</name>
> <value>jdbc:microsoft:sqlserver://DBServerName:1433</value>
> </parameter>
>
> <!-- This Databae Connection Pool Description.-->
> <parameter>
> <name>description</name>
> <value> JDBC Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
> </parameter>
>
> </ResourceParams>
> </Host>
> </Engine>
> </Service>
> </Server>
>
> Thanks a lot
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]