Discussion:
DB Connection Pooling
Emil Hedenberg
2010-06-15 06:51:56 UTC
Permalink
Hi,

I run the Community edition of Mule and need a way to Pool and programaticaly get access to DB Connections.
Can anyone help me here?

/E

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Dirk Olmes
2010-06-15 07:24:38 UTC
Permalink
Post by Emil Hedenberg
Hi,
I run the Community edition of Mule and need a way to Pool and programaticaly get access to DB Connections.
Can anyone help me here?
Don't you already configure a JDBC pool in your spring config for Mule?
If so, you can look up the pool from Mule's registry and use it
programmatically.

-dirk

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Magnus Larsson
2010-06-15 07:27:47 UTC
Permalink
Hello!

We have a setup where we use Apache DBCP for connection pooling in a very
straight forward way:

<spring:bean id="*jdbcDataSource*"
class="org.apache.commons.dbcp.BasicDataSource">
<spring:property name="driverClassName" value="..."/>
<spring:property name="url" value="..."/>
<spring:property name="username" value="..."/>
<spring:property name="password" value="..."/>
<spring:property name="initialSize" value="..."/>
<spring:property name="maxActive" value="..."/>
<spring:property name="maxIdle" value="..."/>
</spring:bean>

..and then we inject the datasource in mule service components like:

<service name="...">
<inbound>...</inbound>

<component>
<singleton-object class="...">
<property key="dataSource" value-ref="*jdbcDataSource*
"/>
</singleton-object>
</component>

Could that work for you as well?

Regards,
Magnus.
--
Magnus Larsson

Callista Enterprise AB
Mobile: +46 (0)733-51 91 72
mailto:magnus.larsson-OvoKyR9uRY09ruZUYCyO/***@public.gmane.org
http://www.callistaenterprise.se


On Tue, Jun 15, 2010 at 8:51 AM, Emil Hedenberg <
Post by Emil Hedenberg
Hi,
I run the Community edition of Mule and need a way to Pool and
programaticaly get access to DB Connections.
Can anyone help me here?
/E
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Emil Hedenberg
2010-06-15 18:13:35 UTC
Permalink
That would probably work. I'll try it out, thanks.

Know if it will work with ojdbc? (Oracle JDBC).

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Magnus Larsson
2010-06-15 21:43:10 UTC
Permalink
Good to here!

Can't see any reason why this shouldn't work with any JDBC compliant driver.

Do you have any specific characteristics in mind when it comes to Oracle
JDBC?

Regards,
Magnus.
--
Magnus Larsson

Callista Enterprise AB
Mobile: +46 (0)733-51 91 72
mailto:magnus.larsson-OvoKyR9uRY09ruZUYCyO/***@public.gmane.org
http://www.callistaenterprise.se


On Tue, Jun 15, 2010 at 8:13 PM, Emil Hedenberg <
Post by Emil Hedenberg
That would probably work. I'll try it out, thanks.
Know if it will work with ojdbc? (Oracle JDBC).
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Emil Hedenberg
2010-07-01 09:46:50 UTC
Permalink
An additional question.

I have this set up now, and 'seems' to be working, since Mule starts.

<component>
<prototype-object class="org.aa.test.CacheXX">
<property key="dataSource" value-ref="jdbcDataSource"/>
</prototype-object>
</component>


With the above injection of the dataSource into the Component, how do I reach it from my component code?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Magnus Larsson
2010-07-01 15:40:19 UTC
Permalink
Hello again!

The dataSource-property assumes that you have declared a corresponding
setter method in your code and that it takes care of the injected
DataSource.

For example you could have code like the following if you prefer to do your
JDBC work based on a spring template class:

private SimpleJdbcTemplate simpleJdbcTemplate = null;

public void setDataSource(DataSource dataSource) {
log.info("Got a datasource: {}", dataSource);
this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
}

Does that answer your question?

Mvh,
Magnus.
--
Magnus Larsson

Callista Enterprise AB
Mobile: +46 (0)733-51 91 72
mailto:magnus.larsson-OvoKyR9uRY09ruZUYCyO/***@public.gmane.org
http://www.callistaenterprise.se


On Thu, Jul 1, 2010 at 11:46 AM, Emil Hedenberg <
Post by Emil Hedenberg
An additional question.
I have this set up now, and 'seems' to be working, since Mule starts.
<component>
<prototype-object class="org.aa.test.CacheXX">
<property key="dataSource" value-ref="jdbcDataSource"/>
</prototype-object>
</component>
With the above injection of the dataSource into the Component, how do I
reach it from my component code?
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...