« Return to Thread: How to configure data source for Jetty server?

Re: How to configure data source for Jetty server?

by Roman Zechner | Liland :: Rate this Message:

Reply to Author | View in Thread



Peter Thomas wrote:

> On Tue, Jul 7, 2009 at 2:08 AM, Igor Vaynberg <igor.vaynberg@...>wrote:
>
>  
>> http://docs.codehaus.org/display/JETTY/JNDI
>>
>> -igor
>>
>> On Mon, Jul 6, 2009 at 1:22 PM, Petr Fejfar<petr.fejfar@...> wrote:
>>    
>>> Hi all,
>>>
>>> When I've started learning Wicket, I followed configuration described
>>> in the book Enjoy web dev ...
>>>
>>> Now I'm trying to migrate my project under Maven's management. I seem
>>> to be almost
>>> finished except data source configuration in the Tomcat's context file:
>>>
>>>  <Resource
>>>    name="jdbc/trackerDataSource"
>>>    auth="Container"
>>>    type="javax.sql.DataSource"
>>>    driverClassName="org.postgresql.Driver"
>>>    url="jdbc:postgresql://localhost/tracker"
>>>    username="xxx"
>>>    password="xxx"
>>>    maxActive="20"
>>>    maxIdle="8"
>>>    defaultAutoCommit="false"
>>>    defaultTransactionIsolation="SERIALIZABLE"
>>>    testOnBorrow="true"
>>>    validationQuery="select 1"/>
>>>
>>> Please, could somebody show me how to achieve
>>> the same effect in Jetty's configuration?
>>>
>>>      
>
> A couple of tips to do the Jetty DataSource JNDI configuration the 'wicket
> way' - in code, instead of xml.
>
> Use a datasource implementation like org.apache.commons.dbcp.BasicDataSource
>
> In the Start.java that you get after following the instructions here:
> http://wicket.apache.org/quickstart.html
>
> Add the following:
>
>         BasicDataSource ds = new BasicDataSource();
>         ds.setUrl("jdbc:hsqldb:.");
>         ds.setDriverClassName("org.hsqldb.jdbcDriver");
>         ds.setUsername("sa");
>         ds.setPassword("");
>
>         NamingEntry.setScope(NamingEntry.SCOPE_GLOBAL);
>         // this line actually registers object in jetty jndi
>         new Resource("java:/mydatasource", ds);
>
> And you can refer the documentation of Apache DPCP to set properties like
> this:
>
> ds.setValidationQuery("SELECT 1");
>
> Thanks,
>
> Peter.
>
>  
In development we are using jetty with a data source from a
src/main/webapp/WEB-INF/jetty-env.xml. We also deploy to jetty servers
in production and use the jetty-env.xml. Btw, does anyone know how to
set the hibernate.dialect via JNDI?

Thanks,

Roman

>>> Thanks, Peter
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>    
>
>  

--
Liland ...does IT better

Liland IT GmbH
Creative Master
email: Roman.Zechner@...
http://www.Liland.at 

office: +43 (0)463 220-111  | fax: +43 463 220-111 DW 33
mobil: +43 (0) 699 122 011 28


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: How to configure data source for Jetty server?