Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » Connection pooling question
Connection pooling question [message #44697] Fri, 17 September 2004 11:48 Go to next message
Eclipse UserFriend
Originally posted by: shyun_chen.yahoo.com

Hi,

I am using Eclipse 3.0 & IBM's web tooling platform contribution.
Anyone knows how to setup database connection pooling from Eclipse using
Tomcat as web server to connect to MS SQL server ?

I setup my Tomcat environment, server.xml & web.xml files according to
Tomcat's "JNDI Datasource HOW-TO"
( http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasou rce-examples-howto.html)
but I am still getting the
"javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context" error. Is there any trick that I need to do in Eclipse
environment?

My Eclipse version 3.0.0
My Tomcat version 5.0.19

Thanks,

Shyun Chen
Re: Connection pooling question [message #44747 is a reply to message #44697] Fri, 17 September 2004 13:37 Go to previous messageGo to next message
Eclipse UserFriend
This is a Tomcat issue. Sounds like you have setup a resource link in
the context. You can do this by going into Tomcat Administrator and
adding a resource link to your data source in you context. You're app
should work then.

I'm sure there is a better way to automate this process using Ant, but I
haven't found it yet.


Regards,

Jeff

Shyun Chen wrote:
> Hi,
>
> I am using Eclipse 3.0 & IBM's web tooling platform contribution.
> Anyone knows how to setup database connection pooling from Eclipse using
> Tomcat as web server to connect to MS SQL server ?
>
> I setup my Tomcat environment, server.xml & web.xml files according to
> Tomcat's "JNDI Datasource HOW-TO"
> ( http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasou rce-examples-howto.html)
> but I am still getting the
> "javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context" error. Is there any trick that I need to do in Eclipse
> environment?
>
> My Eclipse version 3.0.0
> My Tomcat version 5.0.19
>
> Thanks,
>
> Shyun Chen
>
Re: Connection pooling question [message #44776 is a reply to message #44747] Fri, 17 September 2004 14:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: shyun_chen.yahoo.com

My web project name is TestWeb under Eclipse. Every time I
stop&start/restart
the Tomcat server from the Eclipse's Server view, a new version of the
TestWeb.xml will be created in the TomcatHome\conf\Catalina\localhost
directory
with minimum content. (No ResourceLink information)

My questions are:
(1) Is this Eclipse's behavior or Tomcat's behavior?
(2) Can I somehow setup the content of my TestWeb.xml file?

Thanks,

Shyun

Jeff Duska wrote:

> This is a Tomcat issue. Sounds like you have setup a resource link in
> the context. You can do this by going into Tomcat Administrator and
> adding a resource link to your data source in you context. You're app
> should work then.

> I'm sure there is a better way to automate this process using Ant, but I
> haven't found it yet.


> Regards,

> Jeff

> Shyun Chen wrote:
> > Hi,
> >
> > I am using Eclipse 3.0 & IBM's web tooling platform contribution.
> > Anyone knows how to setup database connection pooling from Eclipse using
> > Tomcat as web server to connect to MS SQL server ?
> >
> > I setup my Tomcat environment, server.xml & web.xml files according to
> > Tomcat's "JNDI Datasource HOW-TO"
> >
( http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasou rce-examples-howto.html)
> > but I am still getting the
> > "javax.naming.NameNotFoundException: Name jdbc is not bound in this
> > Context" error. Is there any trick that I need to do in Eclipse
> > environment?
> >
> > My Eclipse version 3.0.0
> > My Tomcat version 5.0.19
> >
> > Thanks,
> >
> > Shyun Chen
> >
Re: Connection pooling question [message #44861 is a reply to message #44776] Sat, 18 September 2004 09:40 Go to previous message
Eclipse UserFriend
Shyun Chen wrote:
> My web project name is TestWeb under Eclipse. Every time I
> stop&start/restart
> the Tomcat server from the Eclipse's Server view, a new version of the
> TestWeb.xml will be created in the TomcatHome\conf\Catalina\localhost
> directory
> with minimum content. (No ResourceLink information)
>
> My questions are:
> (1) Is this Eclipse's behavior or Tomcat's behavior?

This is eclipse behavior. Actually WTP's server tooling behavior.

> (2) Can I somehow setup the content of my TestWeb.xml file?

First of all I think tomcat server tooling should have better
documentation. Second, tomcat should have even better documentation
about JNDI resource management. If you google JNDI resource related
Tomcat problems you'll find thousands of results.

Anyway, your best bet is confuguring JNDI resources in server.xml. To my
understanding you can't configure your resource in META-INF/context.xml
or TomcatHome/conf/Catalina/localhost/<YourApp>.xml.

This way your resource will be available to all applications that refers
to the resource in web.xml.

In your server.xml, immediately after <Host...> tag place the following
DefaultContext declaration:

<DefaultContext>
<Resource auth="Container" name="jdbc/resource_name"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/resource_name">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value >
</parameter>
<parameter>
<name>url</name>
<value>your_url</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>your_driver</value>
</parameter>
<parameter>
<name>username</name>
<value>your_username</value>
</parameter>
<parameter>
<name>password</name>
<value>your_password</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
</ResourceParams>

</DefaultContext>

And, in your application's web.xml file add the following before
</web-app> tag:

<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/resource_name</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


HTH.
/tb.
Previous Topic:[Help] IBM contribution of webtools doesn't work
Next Topic:IBM contribution: JSP editor custom tag code assist
Goto Forum:
  


Current Time: Sat May 17 21:56:06 EDT 2025

Powered by FUDForum. Page generated in 0.03606 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top