Anyone done this successfully?

I have the December 2001 release of Struts (I think this is 1.0) and I am
developing a webapp that has a need for two datasources. I modified the
struts-config and, leaving the default data-source without a key, added the
new data-source (same Oracle database - diff user/pwd).

...
<data-source>
   <set-property property="key"          value="loadFoo"/>
   <set-property property="autoCommit"   value="false"/>
   <set-property property="description"  value="Oracle" />
   <set-property property="driverClass"
value="oracle.jdbc.driver.OracleDriver" />
   <set-property property="maxCount"     value="50"/>
   <set-property property="minCount"     value="1"/>
   <set-property property="url"
value="jdbc:oracle:thin:@192.168.0.10:1521:dev" />
   <set-property property="user"         value="foo"/>
   <set-property property="password"     value="bar"/>
</data-source>
...

The Application class calls:

 public void initDatabase() {
  // try to get a db handle
  DataSource ds = null;
  Connection dbConn = null;

  try {
      ds = super.findDataSource(null);
   dbConn = ds.getConnection();
  } catch (Exception e) {
   return;
  }
.....

I gen the .war file and deploy it. Tomcat starts and you see the first
data-source load and:

    org.apache.struts.util.GenericDataSource
properties are set to the default (null key). Then you see the second
data-source load and the GenericDataSource properties are set to the second
data-source.

Now - when the inits run, he runs the queries against the second data-source
even though I am using the null value for DATA_SOURCE_KEY. ARGGH!

I stumbled through the Digester code and the format of data-source seems
correct.

Can anyone assist? I am pulling what little hair I have left out :o)

Thanks in advance.

Brian

BTW - I also tried naming the default data-source with a key = "default" -
no go. He loads, but the behavior is the same.



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

Reply via email to