tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daxin Zuo" <>
Subject RE: Please help on my DB pool problem --- I followed the struction on the web
Date Mon, 03 May 2004 00:35:03 GMT
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 Even I use the code:
  envCtx = (Context) initCtx.lookup("java:comp/env");
  ds = (ConnectionPoolDataSource ) envCtx.lookup("jdbc/daxin");
  if (ds != null){
	if(ds instanceof{
	    SQLServerDataSource temp =
	    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 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

   ... ...
    ... ...
	<Resource name="jdbc/dbName" auth="container"
type="" />
	<ResourceParams name="jdbc/dbName">

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

     <parameter><name>portNumber</name><value>1433</value> </parameter>
   ... ...

	<description>SQL Server DataSource</description>

Looking forward to more instruction.

-----Original Message-----
From: Parsons Technical Services []
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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message