What library do I need to import for DataSourceSelector? I've been
looking but....
On Jul 29, 2005, at 2:32 PM, Stefano Bagnara wrote:
Look at JDBCVirtualUserTable.java sources.
It's a custom mailet that make use of the data-source.
Relevant code from the init:
----
ComponentManager componentManager =
(ComponentManager)getMailetContext().getAttribute
(Constants.AVALON_COMPONENT
_MANAGER);
// Get the DataSourceSelector service
ataSourceSelector datasources =
(DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
// Get the data-source required.
datasource = (DataSourceComponent)datasources.select(datasourceName);
conn = datasource.getConnection();
-----
I found a section called <data-source> in the config.xml and
I was wondering if this is the configuration section I can
use to call a DataSource object in my custom mailet. If so, how?
In config.xml
<data-source name="maildb"
class="org.apache.james.util.dbcp.JdbcDataSource">
<driver>org.gjt.mm.mysql.Driver</driver>
<dburl>jdbc:mysql://xxxxxxxxxxxxxx?xxxxx=xxxxx</dburl>
<user>xxxxx</user>
<password>xxxx</password>
<max>20</max>
</data-source>
-----------------------------------------------------------------
In Java.class
Context ctx = new InitialContext();
DataSource dat = (DataSource) ctx.lookup("?????");
con = dat.getConnection();
Brian Goodrich
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]