Heres how i do it and it works with struts 1.1rc1

in the struts-config i have

<data-sources>
    <data-source key="SystemsLog">
      <set-property value="jdbc:mysql://localhost/SystemsLog" property="url" 
/>
      <set-property value="org.gjt.mm.mysql.Driver" property="driverClass" />
      <set-property value="user" property="user" />
      <set-property value="password" property="password" />
    </data-source>
  </data-sources>

then to get the datasource in a struts action i do

javax.sql.Datasource ds = this.getDatasource( httpServletRequest , 
"SystemsLog" );

java.sql.Connection conn = ds.getConnection( );

as the Action has a method to retreive a datasource for it



On Thursday 20 March 2003 12:18 am, Jimmy Emmanual wrote:
> How do you access a DataSource from an action class via its "key"? I have
> multiple DataSources defined in the struts-config.xml file each have the
> "key" property set. I need to access these based on this "key".
>
> ---------------------------------------------------------------------
> 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