You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daxin Zuo <dz...@techexcel.com> on 2004/05/02 21:07:12 UTC

RE: Please help on my DB pool problem --- I followed the struction on the web

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:parsonstechnical@earthlink.net]
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" <dz...@techexcel.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
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:R.STOCKHOLM@aubay.lu]
> 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:dzuo@techexcel.com]
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Please help on my DB pool problem --- I followed the struction on the web

Posted by Parsons Technical Services <pa...@earthlink.net>.
Daxin,

I think this would be well worth your time and effort to change to this. I
was unaware of it or I would have recommended it.

The reason for the other stuff you were asking about was because that is how
microsoft had set it up to be used.

This should give much cleaner and portable code. As I am running against
MySQL I cannot test it, but will help you get it going.

Thanks  for the info Eric.

Doug

----- Original Message ----- 
From: "Eric Noel" <er...@mylife.ph>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Sunday, May 02, 2004 8:55 PM
Subject: Re: Please help on my DB pool problem --- I followed the struction
on the web


> why not use jtds instead http://jtds.sourceforge.net/
>
> ## download the jtds jar
>    http://heanet.dl.sourceforge.net/sourceforge/jtds/jtds-0.7.1.jar
> ## place it in your common/lib
>
> ## server.xml
>    <Resource name="jdbc/DirectSQL" auth="Container"
> type="javax.sql.DataSource"/>
>    <ResourceParams name="jdbc/DirectSQL">
>      <parameter>
>        <name>factory</name>
>        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>      </parameter>
>      <parameter>
>        <name>maxActive</name>
>        <value>3</value>
>      </parameter>
>      <parameter>
>        <name>maxIdle</name>
>        <value>1</value>
>      </parameter>
>      <parameter>
>        <name>maxWait</name>
>        <value>10000</value>
>      </parameter>
>      <parameter>
>       <name>username</name>
>       <value>DBUSERNAME</value>
>      </parameter>
>      <parameter>
>       <name>password</name>
>       <value>DBPASSWORD</value>
>      </parameter>
>      <parameter>
>         <name>driverClassName</name>
>         <value>net.sourceforge.jtds.jdbc.Driver</value>
>      </parameter>
>      <parameter>
>        <name>url</name>
>        <value>jdbc:jtds:sqlserver://SERVERNAME/DBNAME</value>
>      </parameter>
>    </ResourceParams>
>
>
> ## web.xml
> <context-param>
>     <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
>     <param-value>jdbc/DirectSQL</param-value>
> </context-param>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Please help on my DB pool problem --- I followed the struction on the web

Posted by Eric Noel <er...@mylife.ph>.
On 5/3/2004 9:31 AM, Daxin Zuo wrote:

> I thought Microsoft was the best.
if thats what you think, i guess you should stick with dotNet since with 
that you will have an all microsoft retrofitted program (e.g drivers, 
components, etc) :-)

> My jsp file is in tomcat\webapps\ROOT\zuo. In my
> tomcat\webapps\ROOT\WEB-INF\web.xml, there is no <context> block, should I
> create one or use <resource-ref>?
> If I need ot create a <context> block, Is the code bellow correct:
> <context path="/zuo" docBase="ROOT" debug="0" privileged="true">
> ....
> </context>

Context part is in server.xml or Catalina/hostname/APPNAME.xml.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Please help on my DB pool problem --- I followed the struction on the web

Posted by Daxin Zuo <dz...@techexcel.com>.
I thought Microsoft was the best.
My jsp file is in tomcat\webapps\ROOT\zuo. In my
tomcat\webapps\ROOT\WEB-INF\web.xml, there is no <context> block, should I
create one or use <resource-ref>?
If I need ot create a <context> block, Is the code bellow correct:
<context path="/zuo" docBase="ROOT" debug="0" privileged="true">
....
</context>

Thanks

-----Original Message-----
From: Eric Noel [mailto:ericnoel@mylife.ph]
Sent: Sunday, May 02, 2004 5:55 PM
To: Tomcat Users List
Subject: Re: Please help on my DB pool problem --- I followed the
struction on the web


why not use jtds instead http://jtds.sourceforge.net/

## download the jtds jar
   http://heanet.dl.sourceforge.net/sourceforge/jtds/jtds-0.7.1.jar
## place it in your common/lib

## server.xml
   <Resource name="jdbc/DirectSQL" auth="Container"
type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/DirectSQL">
     <parameter>
       <name>factory</name>
       <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
     </parameter>
     <parameter>
       <name>maxActive</name>
       <value>3</value>
     </parameter>
     <parameter>
       <name>maxIdle</name>
       <value>1</value>
     </parameter>
     <parameter>
       <name>maxWait</name>
       <value>10000</value>
     </parameter>
     <parameter>
      <name>username</name>
      <value>DBUSERNAME</value>
     </parameter>
     <parameter>
      <name>password</name>
      <value>DBPASSWORD</value>
     </parameter>
     <parameter>
        <name>driverClassName</name>
        <value>net.sourceforge.jtds.jdbc.Driver</value>
     </parameter>
     <parameter>
       <name>url</name>
       <value>jdbc:jtds:sqlserver://SERVERNAME/DBNAME</value>
     </parameter>
   </ResourceParams>


## web.xml
<context-param>
    <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
    <param-value>jdbc/DirectSQL</param-value>
</context-param>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Please help on my DB pool problem --- I followed the struction on the web

Posted by Eric Noel <er...@mylife.ph>.
why not use jtds instead http://jtds.sourceforge.net/

## download the jtds jar
   http://heanet.dl.sourceforge.net/sourceforge/jtds/jtds-0.7.1.jar
## place it in your common/lib

## server.xml
   <Resource name="jdbc/DirectSQL" auth="Container" 
type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/DirectSQL">
     <parameter>
       <name>factory</name>
       <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
     </parameter>
     <parameter>
       <name>maxActive</name>
       <value>3</value>
     </parameter>
     <parameter>
       <name>maxIdle</name>
       <value>1</value>
     </parameter>
     <parameter>
       <name>maxWait</name>
       <value>10000</value>
     </parameter>
     <parameter>
      <name>username</name>
      <value>DBUSERNAME</value>
     </parameter>
     <parameter>
      <name>password</name>
      <value>DBPASSWORD</value>
     </parameter>
     <parameter>
        <name>driverClassName</name>
        <value>net.sourceforge.jtds.jdbc.Driver</value>
     </parameter>
     <parameter>
       <name>url</name>
       <value>jdbc:jtds:sqlserver://SERVERNAME/DBNAME</value>
     </parameter>
   </ResourceParams>


## web.xml
<context-param>
    <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
    <param-value>jdbc/DirectSQL</param-value>
</context-param>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Please help on my DB pool problem --- I followed the struction on the web

Posted by Daxin Zuo <dz...@techexcel.com>.
Thank you very much for your reply on Sunday.
The error is "Name jdbc is not bound in this Context" at ctx.lookup. In both
server.xml and web.xml, the type is
com.microsoft.jdbcx.sqlserver.SQLServerDataSource. Even I use the code:
  envCtx = (Context) initCtx.lookup("java:comp/env");
  ds = (ConnectionPoolDataSource ) envCtx.lookup("jdbc/daxin");
  if (ds != null){
	if(ds instanceof com.microsoft.jdbcx.sqlserver.SQLServerDataSource){
	    SQLServerDataSource temp =
(com.microsoft.jdbcx.sqlserver.SQLServerDataSource)ds;
	    con = temp.getPooledConnection("dzuo","dzuo").getConnection();

  I got the same error.  Besides jdbc, is there another name to use?
 I am using jdbc driver, why
com.microsoft.jdbc.sqlserver.SQLServerDriver.class in the mssqlserver.jar is
not indicated in the configuration? Why the driverClassName and the type are
the same? Does it related to MS sql server installation? I installed the MS
SQL JDBCdriver's servise pack 1 and 2. Does it have effect?
My current configuration is based on the link you sent me in the first
email:

Server.xml:
   ... ...
  <GlobalNamingResources>
    ... ...
	<Resource name="jdbc/dbName" auth="container"
type="com.microsoft.jdbcx.sqlserver.SQLServerDataSource" />
	<ResourceParams name="jdbc/dbName">
	<parameter>
	<name>factory</name>
	<value>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</value>
	</parameter>
	<parameter>
		<name>driverClassName</name>
		<value>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</value>
	</parameter>
     <parameter>
       <name>driverName</name><value>SQLServer</value>
     </parameter>

     <parameter><name>description</name><value>SQL Server
DataSource</value></parameter>

     <parameter><name>serverName</name><value>"daxin"</value></parameter>
     <parameter><name>portNumber</name><value>1433</value> </parameter>
    <parameter><name>selectMethod</name><value>cursor</value></parameter>
     <parameter><name>databaseName</name><value>pubs</value></parameter>
	<parameter><name>user</name><value>"dzuo"</value></parameter>
	<parameter><name>password</name><value>"dzuo"</value></parameter>
	</ResourceParams>
      ......
  </GlobalNamingResources>
   ... ...
   </Engine>
  </Service>
</Server>

web.xml:
  ....
  <resource-ref>
	<description>SQL Server DataSource</description>
	<res-ref-name>"jdbc/dbName"</res-ref-name>
	<res-type>com.microsoft.jdbc.sqlserver.SQLServerDataSource</res-type>
	<res-auth>Container</res-auth>
  </resource-ref>
</web-app>

Looking forward to more instruction.

-----Original Message-----
From: Parsons Technical Services [mailto:parsonstechnical@earthlink.net]
Sent: Sunday, May 02, 2004 4:07 PM
To: Tomcat Users List
Subject: Re: Please help on my DB pool problem --- I followed the
struction on the web


Try this code instead:

Context ctx = new InitialContext();
if (ctx == null) {
System.err.println("Conn.getConn ctx is null");
throw new Exception("Boom - No Context");
}
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/dbName");
if (ds != null)
connection = ds.getConnection();

I run this from a class. I have several util classes that handle my database
queries and thus in my jsps and servlets I simly call the util class with a
simple string. But we'll save that for another time.


As for the code in the web.xml, it is fine.

Doug


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Please help on my DB pool problem --- I followed the struction on the web

Posted by Parsons Technical Services <pa...@earthlink.net>.
Try this code instead:

Context ctx = new InitialContext();
if (ctx == null) {
System.err.println("Conn.getConn ctx is null");
throw new Exception("Boom - No Context");
}
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/dbName");
if (ds != null)
connection = ds.getConnection();

I run this from a class. I have several util classes that handle my database
queries and thus in my jsps and servlets I simly call the util class with a
simple string. But we'll save that for another time.


As for the code in the web.xml, it is fine.

Doug

----- Original Message ----- 
From: "Daxin Zuo" <dz...@techexcel.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Sunday, May 02, 2004 3:07 PM
Subject: RE: Please help on my DB pool problem --- I followed the struction
on the web


> 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:parsonstechnical@earthlink.net]
> 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" <dz...@techexcel.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> 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:R.STOCKHOLM@aubay.lu]
> > 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:dzuo@techexcel.com]
> > 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: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org