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


Reply via email to