You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Miroslav Nachev <mi...@space-comm.com> on 2006/11/07 10:41:11 UTC

What is the correct way for custom Database (JDBC) access

Hi,

I am writing to both Server-User and Server-Dev because I am new and I 
don't know which mail list is the right for my questions:

   1. My custom matcher and mailet (MatchFaxRecipient & SendMailAsFax)
      needs to access MySQL Database to retrieve and store data in. What
      is the correct way and practice to init and use database ? I have
      to do that in init() method directly with JDBC Drivers and some
      JDBC Spool or I have to use the rules of James for that like
      Datasource or another? In case that I have to use James rules,
      from where to read or to see same samples how to configure James
      XML configuration files?
   2. I do some tests and I see that the same mailet is running in
      different thread each time when is invoked. Do I need to start new
      thread for invoking of service() method of each mailet or the
      multitasking is not my care?


Regards,
Miro.

Re: What is the correct way for custom Database (JDBC) access

Posted by Danny Angus <da...@gmail.com>.
Miro,

Don't post to both lists, pick one.


> My custom matcher and mailet (MatchFaxRecipient & SendMailAsFax) needs to
> access MySQL Database to retrieve and store data in. What is the correct way
> and practice to init and use database ?

Mailet API as it stands does not provide any mechanism for JDBC datasources.
However James does, see the code for initDb()  in
org.apache.james.transportMailets.BayseianAnalysis.java

http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java?view=markup

> I do some tests and I see that the same mailet is running in different
> thread each time when is invoked. Do I need to start new thread for invoking
> of service() method of each mailet or the multitasking is not my care?

It is not your concern, James manages the threads, you just have to
write your mailet.

d.

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