Hi

Here is a modified extract of the sample code. I have not tried it though.

javax.sql.DataSource dataSource = (javax.sql.DataSource)
      getServletContext().getAttribute(Action.DATA_SOURCE_KEY);
java.sql.Connection conn  = dataSource.getConnection();
CachedRowSet crs = new CachedRowSet()
crs.setCommand("Select name,telephone from Contacts");
crs.execute(conn);

The "DATA_SOURCE_KEY" refers to the data-source property in your
struts-config.xml file.

  <data-sources>
    <data-source
       autoCommit="false"
      description="TeaTimeJ MySQL Datasource"
      driverClass="org.gjt.mm.mysql.Driver"
         maxCount="4"
         minCount="2"
         password="yyyyyy"
              url="jdbc:mysql://10.0.0.1/teatimej?autoReconnect=true"
             user="teatimej"
    />
  </data-sources>

Hope it helps

Michael Mok
www.webappcabaret.com/teatimej

----- Original Message -----
From: "Scott Walter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 11:34 PM
Subject: Re: Connection Pooling, GenericDataSource, JNDI, CachedRowSet


> I have used the CacheRowSet however I get the
> connection from GenericDataSource manually and
> associate it with the CachedRowSet.
>
> You might want to do a search at JavaWorld, there was
> an article within the last 5 months that talks all
> about the CachedRowSet.
>
> --- Christophe Thiébaud <[EMAIL PROTECTED]> wrote:
> > Hi
> >
> > my problem is : how to make GenericDataSource
> > visible to JNDI ?
> >
> > I need to interface a CachedRowSet object - BTW, is
> > there anybody out here using
> > Sun's CachedRowSet ? - with struts's
> > GenericDataSource in a struts-based
> > application. CachedRowsSet can connect to a
> > DataSource object using JNDI., but
> > .. how to make GenericDataSource visible to JNDI ?
> >
> > (Furthermore, If several person share the same need,
> > it might be a good idea to
> > include JNDI directly within GenericDataSource
> > object.)
> >
> > Or, is there a better alternative to
> > GenericDataSource to integrate
> > connection pooling in a struts based application ?
> >
> > Christophe
>
>
> =====
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Scott
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/

Reply via email to