You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hunkpapa <hu...@gmx.de> on 2001/06/13 13:05:34 UTC

GenericDataSource

Hi,
I've some new questions
to GenericDataSource.
I put this in the struts-config.xml
  <data-sources>
    <data-source
       autoCommit="false"
      description="Example Data Source Configuration"
      driverClass="sun.jdbc.odbc.JdbcOdbcDriver"
         maxCount="4"
         minCount="2"
         password=""
              url="jdbc:odbc:TEST"
             user="sa"
    />
  </data-sources>

I works well.
Here my questiions:
- How does struts manage the connections, if the session is closed cause
the user is gone ? Does it close automatic ?
- How can I  share a "pool" of open connections between all of the
application's current users. ?





Re: GenericDataSource

Posted by Chuck Amadi <ch...@breconbeacons.org>.
Sorry,  anwser to the 1st question , the fact is the session is closed is
because by default there is a 30 minute time out somewhere in xml doc's
either tld or struts-config i'll have 2 take a look as im digesting all this
at work and at home but there is definately a time out period.

Hope this helps as it will mean i made my 1st contrubtion (makes a change )
Cheers newbie (chuck).



hunkpapa wrote:

> Hi,
> I've some new questions
> to GenericDataSource.
> I put this in the struts-config.xml
>   <data-sources>
>     <data-source
>        autoCommit="false"
>       description="Example Data Source Configuration"
>       driverClass="sun.jdbc.odbc.JdbcOdbcDriver"
>          maxCount="4"
>          minCount="2"
>          password=""
>               url="jdbc:odbc:TEST"
>              user="sa"
>     />
>   </data-sources>
>
> I works well.
> Here my questiions:
> - How does struts manage the connections, if the session is closed cause
> the user is gone ? Does it close automatic ?
> - How can I  share a "pool" of open connections between all of the
> application's current users. ?

--
The views expressed by the sender of this message don't
necessarily represent those of Brecon Beacons National Park
Authority. This message is intended for the addressee(s) only
and is sent in confidence; if you receive it in error, please can you
let us know (at it@breconbeacons.org) and then destroy all copies.
Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn
adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog.
Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion
yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn
mewn camgymeriad, a fyddech gystal â rhoi gwybod i
ni (yn it@breconbeacons.org) ac yna dilëwch bob copi.



Re: GenericDataSource

Posted by Chuck Amadi <ch...@breconbeacons.org>.
Hi, Im a newbie myself albeit i did managed to succeed in the generi
datasource URI example.
1) the Struts manages to make a connection via the url IP address for
example mine is -
<sql:url>jdbc:postgresql: / /111.15.1.10/test1</sql:url> // test1 the name
of my database in postgresql. thus you need to exstablish your database
driver mine was<sql:driver>org.postgresql.Driver</sql:driver> note  diffrent
drivers use different URL's it is also suggested that you stray away from
odbc (MSAccess) as JDBC-ODBC bridge driver is used usually for prototyping
purposes.

2) the session is either closed by pasing it's reference to the
closeConnction tag. and within unless your you are performing your own
connection pooling which im currently working on, thus if not you close it
down <sql:closeConnection id="conn1" />

3) I hav eso far used the Datasource as it is generic and easier to
administer/config  thus a connection pool is connections that can be shared
by multiple clients note that this is tediuosly but interestingly long
basically a connection is opened once and stays open until the app is shut
down thus if you need a connection it gets it from the pool thru the
datasource object and excutes a SQL statements. thus when the connection is
apparently closed the connection is returned to the pool where it can be
used by the next action that requires it. Thus the syntax is
<sql:useDatasource> action implements a basic connection pool. Hence i am
still playing around with it.

Hope this helps as i seem 2 get good ideas from this community.
Cheers Chuck.

hunkpapa wrote:

> Hi,
> I've some new questions
> to GenericDataSource.
> I put this in the struts-config.xml
>   <data-sources>
>     <data-source
>        autoCommit="false"
>       description="Example Data Source Configuration"
>       driverClass="sun.jdbc.odbc.JdbcOdbcDriver"
>          maxCount="4"
>          minCount="2"
>          password=""
>               url="jdbc:odbc:TEST"
>              user="sa"
>     />
>   </data-sources>
>
> I works well.
> Here my questiions:
> - How does struts manage the connections, if the session is closed cause
> the user is gone ? Does it close automatic ?
> - How can I  share a "pool" of open connections between all of the
> application's current users. ?

--
The views expressed by the sender of this message don't
necessarily represent those of Brecon Beacons National Park
Authority. This message is intended for the addressee(s) only
and is sent in confidence; if you receive it in error, please can you
let us know (at it@breconbeacons.org) and then destroy all copies.
Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn
adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog.
Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion
yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn
mewn camgymeriad, a fyddech gystal â rhoi gwybod i
ni (yn it@breconbeacons.org) ac yna dilëwch bob copi.


Re: GenericDataSource

Posted by Chuck Amadi <ch...@breconbeacons.org>.
oops me again i 4 got to mention that there is a set of interfaces that
connection pools implement ie
javax.sqlDatasource
javax.sql.ConnectionPoolDatasource
javax.sql.PooledConnection.

Thus you have the JDBC 2.0 Connection pool note that DBtags has replaced
JDBC tag library you may continue to use JDBC .

hunkpapa wrote:

> Hi,
> I've some new questions
> to GenericDataSource.
> I put this in the struts-config.xml
>   <data-sources>
>     <data-source
>        autoCommit="false"
>       description="Example Data Source Configuration"
>       driverClass="sun.jdbc.odbc.JdbcOdbcDriver"
>          maxCount="4"
>          minCount="2"
>          password=""
>               url="jdbc:odbc:TEST"
>              user="sa"
>     />
>   </data-sources>
>
> I works well.
> Here my questiions:
> - How does struts manage the connections, if the session is closed cause
> the user is gone ? Does it close automatic ?
> - How can I  share a "pool" of open connections between all of the
> application's current users. ?

--
The views expressed by the sender of this message don't
necessarily represent those of Brecon Beacons National Park
Authority. This message is intended for the addressee(s) only
and is sent in confidence; if you receive it in error, please can you
let us know (at it@breconbeacons.org) and then destroy all copies.
Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn
adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog.
Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion
yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn
mewn camgymeriad, a fyddech gystal â rhoi gwybod i
ni (yn it@breconbeacons.org) ac yna dilëwch bob copi.