I have the following questions:
1. I have developed a javax.sql.DataSource implementation which I want my J2EE application to use. That is, wish to be able to retrieve this DataSource from code by JNDI lookup (and I also want the CMPs to use this DataSource). In the deployment tool, I can define a jdbc driver, dbURL, and a JNDI name, and then reference that JNDI name with username, and password in the deployment settings for a component.
My question is: Where can I define the DataSource implementation to be used for the application? Is this not at all possible?
2. I need to get instances of other DataSources in the code. I was planning on initializing the DataSources on startup and store a JNDI reference to them (and in code, I then access the DataSources by JNDI lookup). Isn't this the best way?
3. Is the DataSource that the container is using for the CMP management in any way special, that is, will I be suffering any performance loss by using another DataSource?
4. I know that I can define a <resource-ref> to a DataSource in my components, so that they always reference the same JNDI name. But every time that I deploy the application, I need to manually type in the username and password for the database.Isn't there a way to embed this information in a deployment descriptor, so that a default username and password can be provided? You might wonder why this would be a requirement, but the application will create the db user by it self, so the user does not have to know anything about it (unless he wants to).
Any discussion of the above topics will be greatly appreciated. Thanks for your help.