With Spring you can use any pooled (poolable?) datasource... for example c3p0's
ComboPooledDataSource or Apache's DBCP BasicDataSource. Proxool is
also an option.

By the way, I have had a terrible day or two struggling with Spring +
Hibernate + Apache's DBCP + WebSphere closing the socket in the middle
of transactions. Switched to c3p0 and all was sunshine and light
again.

In the midst of troubleshooting I came across Matt's blog entry here:
http://www.jroller.com/page/raible?entry=spring_makes_appfuse_more_portable

Matt, in that post you indicated that you chose to go with c3p0 over
DBCP ... but in my version of AppFuse (1.9.4 / webwork) it appears
DBCP is being used. Just curious, did you change for any specific
reason? In researching this error I saw that the Hibernate folks don't
have much nice to say about DBCP , and I of course had my own problems
(only on WebSphere - Tomcat works fine).

Thanks,
Jason



On 4/20/07, Nathan Anderson <[EMAIL PROTECTED]> wrote:
I probably just need to read more, but in case you know off the top of
your head... ;)

I hope that spring is using some sort of connection pooling?  And is
there a way that you know of to configure a cache?  The DB2 database
connection will be going over the Internet, so I want to minimize it as
much as I can.

Thanks,
Nathan

Sanjiv Jivan wrote:
> If you're not planning on using Hibernate for fetching data from the
> second datasource, then you dont need to define a second
> SessionFactory bean. Just define a second DataSource bean and inject
> it into your DAO's. You can then use the Spring JDBC helper classes by
> utilizing the DB2 DataSource that you injected in your DAO's. All of
> the Spring JDBC helper classes like MappingSqlQuery and JdbcTemplate
> can be constructed using a DataSource object.
>
>
> On 4/20/07, *Nathan Anderson* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi Sanjiv,
>
>     I wasn't sure what I would use to fetch the data from the DB2
>     database.
>     Hibernate crossed my mind, but then it seemed like it would not be
>     worth
>     the difficulty of just getting the object to map correctly.  I
>     haven't
>     used iBATIS before, so I was starting to look at what JDBC templates
>     Spring has [http://www.springframework.org/docs/reference/jdbc.html ].
>     This is a very simple app other than the fact that there are 2 data
>     sources.  Given the limited time to spend on it and the fact it
>     won't be
>     used a lot [maybe 10 users max], I'm going for simple ;)
>
>     Thanks for the tip and the warning,
>     Nathan
>
>     Sanjiv Jivan wrote:
>     > You just need to define a second SessionFactory bean and inject
>     it in
>     > the DAO's that you need access to it. You'll have to manage this
>     > second session opening and closing manually since the
>     > OpenSessionInViewFilter manages just the the bean names
>     > "sessionFactory". You could setup a second OSIV filter but it
>     might be
>     > overkill depending on how frequently you need to fetch data from
>     your
>     > DB2 database.
>     >
>     > I would personally use Ibatis for fetching read-only data since it
>     > takes a lot of work to get Hibernate to perform efficiently as a
>     data
>     > mapper alone when you dont need its ORM capabilities. (Getting
>     > Hibernate to perform efficiently when working with large amounts of
>     > read only data is a battle I've almost given up on). However if
>     would
>     > still like to use Hibernate for your read-only DB2 data, make sure
>     > you're using Hibernate's StatelessSession API or else you'll just be
>     > paying a huge CPU and memory overhead using Hiberanate.
>     >
>     > On 4/20/07, *Nathan Anderson* < [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
>     >
>     >     [ You thought I was kidding about the 60 seconds, huh? ;) ]
>     >
>     >     So I need to have 2 data sources in my application.  The
>     AppFuse core
>     >     and my CRUD classes are being persisted to a MySQL
>     database.  I also
>     >     need fetch Read-Only objects from a DB2 database.  Being new
>     to maven
>     >     I'm a little stumped on how to add the JDBC jars for
>     DB2.  But even
>     >     after I figure that out I'm not sure how to configure a second
>     >     dataSource.  I'm guessing I create a new "dataSource" bean,
>     but I
>     >     don't
>     >     see how to tell Hibernate or some other mechanism to connect
>     to it.
>     >
>     >     Thanks,
>     >     Nathan
>     >
>     >
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail:
>     [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >     <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>
>     >     For additional commands, e-mail:
>     [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >     <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>
>     >
>     >
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     For additional commands, e-mail: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>
>

---------------------------------------------------------------------
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]

Reply via email to