tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Pellegrino <roberto.pellegr...@quix.it>
Subject Re: Tomcat data source
Date Tue, 04 Dec 2007 10:46:09 GMT
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: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>



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


Mime
View raw message