You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Smith <ss...@mainstreamdata.com> on 2006/04/15 00:23:06 UTC

Tomcat 5.5.16 configuration problem

I have specified the following as myapp.xml in the
conf\Catalina\locahost directory:

 

<Context path="/myapp">

 

            <Resource name="jdbc/MyDB" auth="Container"

                        type="javax.sql.DataSource" 

                        username="user" password="pswd"

 
driverClassName="net.sourceforge.jtds.jdbc.Driver"

 
url="jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=MyDB;SelectMethod
=cursor"

                        maxActive="30" maxIdle="20" minIdle="10"
maxWait="20000" />

            <Realm className="org.apache.catalina.realm.DataSourceRealm"
debug="99"

                        dataSourceName="jdbc/MyDB"

                        userTable="zUsers" userNameCol="zUserName"
userCredCol="zPassword"

                        userRoleTable="wsViewRoles" roleNameCol="zRole"
/>

</Context>

 

In my web.xml file I have:

 

  <resource-ref>

            <res-ref-name>jdbc/MyDB</res-ref-name>

            <res-type>javax.sql.DataSource</res-type>

            <res-auth>Container</res-auth>

  </resource-ref>

 

But, when I execute the code

 

            DataSource ds = null;

            try 

            {

                        Context initCtx = new InitialContext();

                        Context envCtx = (Context)
initCtx.lookup("java:comp/env");

                        envCtx = (Context)
initCtx.lookup("java:comp/env");

                        ds = (DataSource)
envCtx.lookup("jdbc/MediaBrowserDB");

            } 

            catch (NamingException e) 

            {

                        _log.error("Unable to retrieve MyDB DataSource",
e);

                        ds = null;

            }

 

I get an error message which says 

 

 

Scott Smith

 

SVP Technology

Mainstream Data

375 Chipeta Way, Suite B

Salt Lake City, Ut 84108

801-584-2817