DataSource defined on webApp context are accessed by similar url : java:comp/env/jdbc/dataSourceName.
Now.
Is't possible use with a url datasource that are only defined in GlobalNamingResources (in server.xml) using the name ???

- Robert -

David Smith wrote:
Then you might want to incorporate your own DBCP pool and a brief config page in your webapp.

- Store config data in a properties file inside WEB-INF or somewhere else. - Use a ServletContextListener to initialize the DataSource and store it in the ServletContext. - Implement a secured jsp or servlet to configure DBCP at runtime and store the result in the config file - On change have the jsp or servlet close down the existing DBCP and replace it with a new one. - Update all the other jsps and servlets to get their DataSource from the ServletContext

That's what I'd do at least.

--David

Roberto Pellegrino wrote:
I have a particular application who make select query and show results.
The dataSource are dinamic and defined by the administrator, not know at develop time.
I want to be able to use the tomcat dataSource to use the pool...

- Robert -

David Smith wrote:
I don't think you can just define a global datasource and not make a reference to it in the context.xml file.

--David

Roberto Pellegrino wrote:
Hi all,
i use Tomcat *5.5.17 *my question is quite simple: it's possible to use a dataSource that are not defined on webApp context???

I define the dataSource on server.xml as follow:

<Resource auth="Container" driverClassName="DriverClassName"
       validationQuery="select count(*) from table"
maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/DataSourceName" password="pass" type="javax.sql.DataSource" url="jdbc:DBMS://ServerName:Port/dbName" username="user"/>
  After, i want to be able use this dataSource on java program...
Normally this is the java code to get the dataSource:
   InitialContext initialContext = new InitialContext();
DataSource ds = (DataSource) initialContext.lookup("jdbc:DBMS://ServerName:Port/DbName");
   conn = ds.getConnection();
If the dataSource is not defined on context (<ResourceLink name="jdbc/DataSourceName" global="jdbc/DataSourceName" type="javax.sql.DataSource"/>) the code return an exception:

Name DataSourceName is not bound in this Context.

Any Suggestions????

Robert.

















---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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