You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Romain Bertucelli <rb...@fr.st> on 2001/04/19 16:08:33 UTC
Properties + jdbc
Hi all,
I'm begining working with Tomcat and servlets and I've heard that jdbc
parameters (jdbc url, login, passwd) should be set in a .properties file.
My question : How do I get these parameters in my DataBaseAccess Class (I
mean, with which method) ?
Thanks in advance,
Romain.
Re: Properties + jdbc
Posted by Ivan <iv...@abac.com>.
You can create context parameters in the web.xml file as such:
<context-param>
<param-name>LOGIN_NAME</param-name>
<param-value>sa</param-value>
</context-param>
and then access them in code like this:
ServletContext ctx = getServletContext();
String loginname = ctx.GetInitParameter(LOGIN_NAME);
Hope this helps
Ivan
----- Original Message -----
From: "Romain Bertucelli" <rb...@fr.st>
To: <to...@jakarta.apache.org>
Sent: Thursday, April 19, 2001 7:08 AM
Subject: Properties + jdbc
> Hi all,
>
> I'm begining working with Tomcat and servlets and I've heard that jdbc
> parameters (jdbc url, login, passwd) should be set in a .properties file.
>
> My question : How do I get these parameters in my DataBaseAccess Class (I
> mean, with which method) ?
>
> Thanks in advance,
>
> Romain.
>