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]

Reply via email to