cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <gkossakow...@apache.org>
Subject Re: C2.2: Howto add a database as a datasource
Date Tue, 16 Oct 2007 19:57:26 GMT
Hanne Moa pisze:
> There is an example of how to add a database for 2.1.x at
> <http://cocoon.apache.org/2.1/developing/datasources.html>, and
> databases that supply jdbc-drivers also tell where you should put the
> .jar-file. For 2.2 there's the migration guide at
> <http://cocoon.apache.org/2.2/blocks/databases/1.0/1409_1_1.html> but
> this doesn't mention where to put the jdbc-driver's jar-file when using
> something else than hsqldb.
> In 2.10 it could be put in WEB-INF/lib of the cocoon root, where should
> it go for 2.2?

I think that the best way is to create simple Maven module by following
cocoon-databases-hsqldb-client module as an example. In short this module should contain:
a) property file similar to the
src/main/resources/META-INF/cocoon/properties/cocoon-databases-hsqldb-client.properties that
will
tell Cocoon to load jdbc driver
b) dependency on the driver of your choice, in pom.xml you can see:
    <dependency>
      <groupId>hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
    </dependency>
You should search Maven repository for driver for your database and add necessary dependency
and
that's all. It will be added automatically to the classpath. If you need a driver that is
not
uploaded on Maven's repository you can install it by hand in your local Maven repository,
see [1].

Of course, you don't need to create separate module and you can put everything to the block
you are
developing. It's your choice if you want clear separation or not.

Last note: Instead of installing of jdbc driver you could just put it into WEB-INF/lib of
your
webapp module (created from webapp archetype). Be warned that I haven't tried this method
so I have
no idea if it's going to work.

> Oh, and there should be a guide for how to set up a database as a
> datasource besides the migration-guide too of course, unless no new
> users are wanted ;)

Certainly new users are wanted and I agree with you that some document for newbies is needed.
Anyway, it's always that someone has to write it. As you already gathering all needed knowledge
could you try to write such document? I (and others) would be very grateful!

[1] http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

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


Mime
View raw message