I believe you can define data sources in server.xml for tomcat at least,
and make them available for multiple applications. But I have not done that
yet (using Oracle connection pool classes).

Brad



                                                                                       
                              
                      david chan                                                       
                              
                      <david_tomcat@ya         To:      Struts Users Mailing List 
<[EMAIL PROTECTED]>   
                      hoo.com>                 cc:                                     
                              
                                               Subject: RE: db connection pool 
question                              
                      21-01-03 09:43                                                   
                              
                      Please respond                                                   
                              
                      to "Struts Users                                                 
                              
                      Mailing List"                                                    
                              
                                                                                       
                              
                                                                                       
                              




With the use data-sources in Struts-config.xml, How
can I get the data-source in my initServlet that will
be loaded during startup of tomcat (or websphere)? My
initServlet will do one time loading of some data from
Oracle database and store them into application scope
and shared by different session. There are a couple of
things need to be sure:

1) struts datasource should be setup first (does
setting servlet loading sequence in web.xml, i.e.
ActionServlet will load first, then is my initServlet
etc...)
2) how to get the datasource from initServlet?
3) In general, I would like to ask what's the better
pratice to do web application initialization when
using Struts framework. i.e. init datasource, log4j
etc... So that I don't need to customize config for
tomcat, webshpere etc..

(My current solution doesn't use data-source within
Struts-config.xml, and I don't like that because I
need to do some config in tomcat's server.xml which
make it depends on app. server)

Thanks.
David

--- Bradley G Smith <[EMAIL PROTECTED]> wrote:
>
> If the Oracle class has the getter and setter
> methods, then yes, you can
> set these properties. Struts is very nice about
> conforming to JavaBean
> standards. I seem to recall that there were a couple
> of properties in the
> Oracle class that did not conform to JavaBean
> standards, but most did.
>
> Brad
>
>
>
>
>
>
>                       david chan
>
>
>                       <david_tomcat@ya         To:
>    Struts Users Mailing List
> <[EMAIL PROTECTED]>
>                       hoo.com>                 cc:
>
>
>
> Subject: RE: db connection pool question
>
>                       21-01-03 09:13
>
>
>                       Please respond
>
>
>                       to "Struts Users
>
>
>                       Mailing List"
>
>
>
>
>
>
>
>
>
>
>
>
> Can I configure the MAX_LIMIT, MIN_LIMIT or
> maxActive,
> maxIdle property for Oracle datasource?
> I look at the oracle817 JDBC API docs, there is only
> one class "OracleOCIConnectionPool" with some
> properties like these but not sure I can set them
> within the data-sources element of my
> Struts-config.xml?
>
> David
>
> --- "Raible, Matt" <[EMAIL PROTECTED]>
> wrote:
> > I'm assuming this will work for configuring a
> > context in Tomcat as well?
> >
> >
>
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg51842.html
> >
> > Thanks,
> >
> > Matt
> >
> >
> > > -----Original Message-----
> > > From: Bradley G Smith
> [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, January 21, 2003 9:29 AM
> > > To: Struts Users Mailing List
> > > Cc: david chan; Struts Users Mailing List
> > > Subject: Re: db connection pool question
> > >
> > >
> > >
> > > "select 1 from dual" is the standard way to
> "ping"
> > oracle for a valid
> > > connection. I would also recommend using
> Oracle's
> > connection
> > > pool. It will
> > > do this in the background. We have several
> tomcat
> > and struts
> > > applications
> > > running for weeks without problems. Even with
> > Oracle going
> > > off line for
> > > maintenance.
> > >
> > > I can supply and example struts configuration
> > using Oracle's driver
> > > connection pool driver. Or check the archives
> for
> > this
> > > mailing list, as I
> > > have posted it here. Search using my name or
> > Oracle.
> > >
> > > Brad
> > >
> > >
> > >
> > >
> >
> > >
> >
> > >                       Rick Reumann
> >
> > >
> >
> > >                       <maillist@reuman
> To:
> >
> > > "Struts Users Mailing List"
> > <[EMAIL PROTECTED]>
> > >                       n.net>
> cc:
> >      david
> > > chan <[EMAIL PROTECTED]>
> >
> > >
> > Subject: Re:
> > > db connection pool question
> >
> > >                       21-01-03 07:19
> >
> > >
> >
> > >                       Please respond
> >
> > >
> >
> > >                       to "Struts Users
> >
> > >
> >
> > >                       Mailing List"
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> > >
> > >
> > >
> > > On Tuesday, January 21, 2003, 9:56:09 AM, david
> > wrote:
> > >
> > > dc> Hi,  I am using a connection pool from
> > > dc>
> org.apache.commons.dbcp.BasicDataSourceFactory
> > and the driver is
> > > dc> oracle.jdbc.driver.OracleDriver. It works
> > great until if the
> > > dc> server idle for a few days, then the
> > connection object seems
> > > dc> broken with this error: ==== begin error
> mesg
> > ===
> > > dc> java.sql.SQLException: Io exception:
> Software
> > caused connection
> > > dc> abort: socket wr ite error   at
> > >
> > > I believe I had similar problems here as well
> but
> > it usually only
> > > happened when the DBA would for some reason
> decide
> > to kill connections
> > > that were open. I went with configuring the
> > pooling with whatever
> > > comes packaged with Tomcat and configuring it in
> > the server.xml
> > > making sure to add the extra overhead of
> > performing a validation query
> > >
> > > <parameter>
> > >            <name>validationQuery</name>
> > >            <value>SELECT 'CRAP' FROM
> DUAL</value>
> > > </parameter>
>
=== message truncated ===


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to