You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ja...@phase2online.com on 2001/09/13 16:51:28 UTC

Multiple datasources - is this working at all ?

Hi all,

I went through the whole mail-list , even the archive, found some
"solutions" but none of them worked for me.
Maybe I have some problems with my setup, so here is my info, please help :

In the struts-config.xml :
-------------
  <data-sources>
    <data-source>
        <set-property property="key" value="1" />
        <set-property property="description" value="1" />
        <set-property property="driverClass" value
="org.gjt.mm.mysql.Driver"/>
        <set-property property="maxCount" value="10" />
        <set-property property="minCount" value="2"/>
     <set-property property="url" value="jdbc:mysql://localhost/db1" />
        <set-property property="user" value="user1" />
        <set-property property="password" value="passwd1"/>
    </data-source>

    <data-source>
        <set-property property="key" value="2" />
        <set-property property="description" value="2" />
        <set-property property="driverClass" value
="org.gjt.mm.mysql.Driver"/>
        <set-property property="maxCount" value="5" />
        <set-property property="minCount" value="1"/>
     <set-property property="url" value="jdbc:mysql://localhost/db2" />
        <set-property property="user" value="user2" />
        <set-property property="password" value="passwd2"/>
    </data-source>

  </data-sources>
-----------


in my code ( Action ) I was trying to use :

1. DataSource dataSource = servlet.findDataSource("1");
2. Connection connection = dataSource.getConnection();

however an "NullPointerException" is thrown on the second line of the code
(2. ), that I think means that the dataSource was null, so it cannot find
the dataSource with the key "1". The same happens for key "2".

but when I do :
1. DataSource dataSource = servlet.findDataSource(null);

the code works fine, and I get a handle to the connection.

I need to be able to use both connections.
Am I missing something ?

Thank you.



Jano Fetyko
Script fighter



forget it... select problem solved!

Posted by Marc-Andre Thibodeau <th...@LUB.UMontreal.CA>.
Hi!
Forget about my last email... if it's not already in your trash can!  I solved
the problem by replacing the many "option" tags, by a few "options" tags...  It
makes a huge difference!

MA


Very slow loading select tags...

Posted by Marc-Andre Thibodeau <th...@LUB.UMontreal.CA>.
Hi!
I noticed that when I have many combo boxes in one page, it takes an eternity
to load!!  It is really a problem if some people are trying to load that kind
of page at the same time.  For example, a page with 12 combo boxes, accessed
by 5 people at the same time may take 2-3 minutes to load the page for some of
them.  And of course, it gets even a lot worse if I add more people. Each
select tags has 7 options. The server I use is a PIII 750 Mhz, with 256 Mb
RAM, on linux 7.0.  The struts version I use is 1.0 beta 3.  I use Tomcat 4.0
b5 standalone.
Does anybody understand this phenomeon?!  Can anybody explain to me what is
happening?
Thanks!

MA