You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Eliseo Arias <je...@wiu.edu> on 2005/07/22 18:39:21 UTC

is it possible to have two or more data sources?

hello all

i am brand new to james, i've been playing with the server for a while 
and was wondering something. i wasn't able to find the answer in the 
mail list archives.

due to some specific needs for some projects, we need to archive emails 
in a different DB per project, that is, one mail server storing emails 
in more than one DB. i take it for that i will need to declare more than 
one data source in the data-sources section of config.xml, like in this 
example:

<data-sources>
        <data-source name="maildb1" 
class="org.apache.james.util.dbcp.JdbcDataSource">
            <driver>com.mysql.jdbc.Driver</driver>
            
<dburl>jdbc:mysql://127.0.0.1/project1?autoReconnect=true</dburl>
            <user>auser</user>
            <password>apass<password>
            <max>20</max>
        </data-source>

        <data-source name="maildb2" 
class="org.apache.james.util.dbcp.JdbcDataSource">
            <driver>com.mysql.jdbc.Driver</driver>
            
<dburl>jdbc:mysql://127.0.0.1/project2?autoReconnect=true</dburl>
            <user>auser</user>
            <password>apass</password>
            <max>20</max>
        </data-source>
</data-sources>

then for archiving the emails we will use mailets like the following 
examples:

<mailet match="HasHeader=project1" class="ToRepository">
    <repositoryPath>db://maildb1/james_archives/sent</repositoryPath>
    <passThrough>true</passThrough>
</mailet>

<mailet match="HasHeader=project2" class="ToRepository">
    <repositoryPath>db://maildb2/james_archives/sent</repositoryPath>
    <passThrough>true</passThrough>
</mailet>

i already tried it and im getting errors when executing run.bat, but i 
wanted to know if my logic is correct, or maybe i am missing something?

i am sure it must be some DB privileges issue, something that for the 
time being i can't fix quickly, so i wanted to know if --in theory-- is 
there any problem on having more than one data source in james.

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org