Subject: Re: Help with JDBC Connection Pool
From: Vic C <[EMAIL PROTECTED]>
 ===
I assume (yes!) that this is most popular (at least I know most projects 
  I know of use it) :

http://sourceforge.net/project/showfiles.php?group_id=4899

V.


Mark Johnson wrote:
> [EMAIL PROTECTED] wrote:
> 
>>Mark,
>>Can you post it or send it to me as well. I am looking for examples to do that as 
>well. >Thanks much.
>>
>>Regards,
>>
>>Muki Soomar
>>
> 
> 
> Here it is:
> ****************begin struts-config.xml fragment******************
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> 
> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts 
>Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
> 
> <struts-config>
> 
>   <!-- ========== Data Sources ========== --> 
>    <data-sources>
> 
>       <data-source className="org.apache.struts.config.DataSourceConfig"
>                    key="MyData"
>                    type="org.apache.commons.dbcp.BasicDataSource">
> 
>          <set-property property="driverClassName" 
>                        value="org.postgresql.Driver"/> 
>          <set-property property="maxActive"       
>                        value="4"/> 
>          <set-property property="password"
>                        value="my_postgres_password"/> 
>          <set-property property="url"
>                        value="jdbc:postgresql:mydata"/> 
>          <set-property property="username"
>                        value="my_postgres_username"/>
> 
>       </data-source>
> 
>    </data-sources>
> ****************end struts-config.xml fragment********************
> *******begin overridden ActionForward.execute fragment*******
> HttpSession session = request.getSession();
> BasicDataSource ds = (BasicDataSource) 
>         session.getServletContext().getAttribute("MyData");
> Connection conn = null;
> PreparedStatement prpd_st = null;
> ResultSet res = null;
> try {
>   conn = ds.getConnection();
> *******end overridden ActionForward.execute fragment*********
> *****files you need in WEB-INF/lib that might not be there*****
> $ ls -l WEB-INF/lib
> -rw-r--r--    1 markj    markj      107105 May 21 11:37 commons-collections.jar
> -rw-r--r--    1 markj    markj       35870 May 21 11:37 commons-dbcp.jar
> -rw-r--r--    1 markj    markj       28840 May 21 11:37 commons-pool.jar
> -rw-r--r--    1 markj    markj        6727 May 21 11:37 jdbc2_0-stdext.jar
> -rw-r--r--    1 markj    markj      116204 May 10 14:26 pgjdbc2.jar
> ...
> ***end files you need in WEB-INF/lib that might not be there***
> 
>>-----Original Message-----
>>From: Mark Johnson [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, May 22, 2002 12:58 PM
>>To: [EMAIL PROTECTED]
>>Subject: Re: Help with JDBC Connection Pool
>>
>>I had difficulty getting this working under 1.02, too, but now have it
>>working with BasicDataSource under a nightly build. If you are
>>interested, I can send sample config and code which works under
>>struts-20020520.
>>
> 
>>from [EMAIL PROTECTED]:
> 
>>>Hi,
>>>I'm using struts 1.02 (which is the latest stabel release) and
>>>GenericDataSource is not depricated in this version.   
>>>I have not looked in to the beta releases (which usually will get you more
>>>trouble than the official releases).
>>>
>>>"Mark Johnson" <[EMAIL PROTECTED]> wrote in message
>>
> news:[EMAIL PROTECTED]...
> 
>>>>What struts version are you using? GenericDataSource was recently
>>>>deprecated.
>>>>
>>>>from [EMAIL PROTECTED]:
>>>>I got a little confused with the JDBC connection pool, when trying out
>>>
> the
> 
>>>>samples from struts user guide.
>>>>
>>>>--
>>>>
>>>>Mark Johnson
>>>>[EMAIL PROTECTED]
>>>>
>>>
>>-- 
>>
>>Mark Johnson
>>[EMAIL PROTECTED]
> 
> 


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

Reply via email to