tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Pellegrino <>
Subject Tomcat data source
Date Tue, 04 Dec 2007 10:00:45 GMT
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" 
        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) 
    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????


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message