Tomcat uses commons-beanutils to set all the parameters of org.apache.commons.dbcp.BasicDataSource (or actually tomcat's own refactored copy of it) with the attributes found in the Resource element in server.xml or one of the context.xml files.

I think Johnny is right ... set up your own db pool. You could even pull the same trick with commons-beanutils that tomcat does, just catch where it gets to the password and handle that separately. It's easier and then your webapp can be more self contained and container independent.

--David

Johnny Kewl wrote:
Jevin, my curiousity got the better of me, and I tried to find it for you.... Can see TC loading up the resource in the ResourceFactory, but it just seems that nowhere does it actually read the password and pass it into DBCP.... I havnt checked, but I have a feeling that the DBCP module gets the password directly from the configuration..... I dont have the source for DBCP, so couldnt check.

Anyway, I think its just a really bad idea.... think it will be easier just to setup your own dB pool, and put the passwords where ever you want, thats how I do it....

Good Luck...

----- Original Message ----- From: "Jevin Maltais" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Tuesday, July 03, 2007 9:57 PM
Subject: How internally does a jndi resource get created?


Big picture: Trying to hide the password from the server.xml file and
instead have it in byte code in a compile version of tomcat.

I'm trying to figure out when the jndi resource is being created by
tomcat so I can change the password for a given resource.  It may not
be super clean or OO style but it will work.

Tomcat is kind of overwhelming so I'm looking for help.  It looks like
the HostConfig class parses the server.xml (where my database and
password is defined) and parses it from there but I'm totally lost
where it adds the Resource to JNDI lookup table.

Could someone point me in the right direction?

Cheers!
Jevin

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to