Where are you putting your Resource?  Are you putting it inside your
<Context> element, or in the <GlobalResources> Element ?

For a simple configuration, nest it inside your <Context>.


ie

<Context path="/test" docBase="test">
        <Resource>
        ....
        </Resource>
        <ResourceParams>
        ...
        </ResourceParams>
</Context>


Also, is your try-catch block catching an exception that might help
point to the problem?



- Andrew

-----Original Message-----
From: Turner, John [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, July 13, 2002 1:58 PM
To: 'Tomcat Users List'
Subject: RE: JNDI and/or pooling help (long post)



Thanks for the reply.  I've changed my server.xml Resource object to
match yours (aside from things like username, etc) and still no luck.

As far as I can tell, the Context lookup is working, but when I execute
this line of code, I get nothing (null):

DataSource ds = null;
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MyTestDB");

I'm at a loss as to explain what's going on.  There's nothing in any of
the log files, erverything looks great.  I just can't get a valid
DataSource object, which means I can't get a connection.

Does anyone have any thoughts on what might be going on?  This is very
frustrating...I can't even tell if it's a problem with my tomcat
configuration, my servlet code, the driver, whatever...there aren't any
error messages, just null.

John Turner
[EMAIL PROTECTED]

-----Original Message-----
From: Andrew Conrad [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 12, 2002 7:15 PM
To: 'Tomcat Users List'
Subject: RE: JNDI and/or pooling help (long post)


Also, check your URL. The syntax is also UserName (case-insensitive)

Here's my working resource:

    <ResourceParams name="jdbc/DataStorage">
     <parameter>
      <name>url</name>
      <value>jdbc:microsoft:sqlserver://localhost:1433</value>
     </parameter>
     <parameter>
       <name>validationQuery</name>
       <value>select * from organizations</value>
     </parameter>
     <parameter>
       <name>maxIdle</name>
       <value>2</value>
     </parameter>
     <parameter>
       <name>maxActive</name>
       <value>10</value>
     </parameter>
     <parameter>
       <name>driverClassName</name>
       <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
     </parameter>
     <parameter>
       <name>maxWait</name>
       <value>5000</value>
     </parameter>
     <parameter>
       <name>username</name>
       <value>Andrew</value>
     </parameter>
     <parameter>
       <name>password</name>
       <value>12345</value>
     </parameter>
    </ResourceParams>

Then, once I get the DataSource, then the connection, I do a
setCatalog() to define the correct DB.

- Andrew


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to