A document has been updated: http://cocoon.zones.apache.org/daisy/documentation/1409.html
Document ID: 1409 Branch: main Language: default Name: Migration guide (unchanged) Document Type: Cocoon Document (unchanged) Updated on: 11/16/07 8:37:44 PM Updated by: Grzegorz Kossakowski A new version has been created, state: publish Parts ===== Content ------- This part has been updated. Mime type: text/xml (unchanged) File name: (unchanged) Size: 826 bytes (previous version: 3485 bytes) Content diff: (5 equal lines skipped) <p>This document describes steps needed (or advised) to be made when upgrading to Cocoon Databases 1.0.x.</p> --- <p class="note">This guide assumes that you use cocoon-databases-impl artifact --- with version at least <strong>1.0.0-RC2</strong>.</p> --- <h1>Datasource declaration</h1> --- <p class="note">Migration of datasources is not mandatory. You can leave --- Avalon-style declaration of datasources untouched and use such declared database --- connection in both Avalon and Spring components. Nevertheless, it's highly --- recommended to migrate to Spring declarations because they will be the only one --- actively supported in future versions of Cocoon Databases 1.0.x.</p> +++ <p>If you want to migrate your datasources to Spring beans but still need them +++ in Avalon components (like SQLTransformer) take a look at +++ <a href="daisy:1424">Databases Bridge</a>.</p> --- <p>Consider you have following datasource declaration in <tt>cocoon.xconf</tt> --- file:</p> --- --- <pre> <datasources> --- <jdbc logger="core.datasources.personnel" name="personnel"> --- <pool-controller max="10" min="5"/> --- <dburl>jdbc:hsqldb:hsql://localhost:3306/cocoondb</dburl> --- <user>sa</user> --- <password></password> --- </jdbc> --- </datasources> --- </pre> --- --- <p>Then the only thing you have to do is to create file named --- <tt>datasources.xml</tt> in <tt>META-INF/cocoon/spring</tt> folder of one of --- your blocks with following contents:</p> --- --- <pre><beans xmlns="http://www.springframework.org/schema/beans" --- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" --- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> --- --- <bean name="javax.sql.DataSource/personnel" class="org.apache.cocoon.databases.bridge.spring.avalon.SpringToAvalonDataSourceWrapper"> --- --- <property name="wrappedBean"> --- <bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" > --- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/> --- <property name="url" value="jdbc:hsqldb:hsql://localhost:3306/cocoondb"/> --- <property name="username" value="sa"/> --- <property name="password" value=""/> --- </bean> --- </property> --- --- </bean> --- --- </beans> --- </pre> --- --- <p>When it comes to configuring DataSource it's all you have to do. What's --- important datasource configured that way will be working just fine with old --- Avalon components.</p> --- --- <p class="warn">Configuration of wrapped bean uses DriverManagerDataSource class --- that <strong>does not provide any support for connection pooling</strong>. You --- may want to consider integration of external libraries.<br/> --- See --- <a href="http://www.springframework.org/docs/api/org/springframework/jdbc/datasource/DriverManagerDataSource.html">javadocs --- comments</a> of DriverManagerDataSource class for details.</p> --- --- <p class="note">When you don't plan to use your database connection in --- Avalon-based components you can resign from declaring wrapping bean and only --- declare wrapped bean on its own.</p> --- <h1>Loading of driver class</h1> <p>Thanks to new features of Cocoon 2.2 there is no need to patch (12 equal lines skipped)