The best place to post questions like this is the User list, where there
are more people who can help you.

But, you should either take out the key property, or pass it again
later. If you leave it out, then Struts will use the DATA_SOURCE_KEY for
a default. 

See also the ActionServlet method for returning a datasource the generic
pool.

"Marc Weber (H2Opilot)" wrote:
> 
> Hello !
> 
> i am encountering problems by trying to initialize a
> Database Connnectionpool.
> 
> in struts-config.xml I got the entries:
> 
> ....
> 
> <data-sources>
>         <data-source
>                 autoCommit="false"
>                 description="H2O DATENBANKTEST"
>                 driverClass="org.gjt.mm.mysql.Driver"
>                 maxCount="15" minCount="2"
>                 url="jdbc:mysql://IP/DBname"
>                 user="username"
>                 password="******"
>                 key="theKey"/>
> </data-sources>
> 
> ....
> 
> but by trying to acces these values by the call
> 
>  try {
>      GenericDataSource dataSource =
> (GenericDataSource)servlet.getServletContext().getAttribute(Action.DATA_SOUR
> CE_KEY);
>       conn = dataSource.getConnection();
> 
>       .....
>          //here are my MySQL instructions etc......
> 
> I got a NULLPOINTEREXCEPTION
> If I initialize these values directly via the call
>         dataSource.setAutoCommit(false); Etc....  inside the method
> erverything works.
> 
> BUT I HAVE TO READ THESE VALUES FROM THE STRUTS-CONFIG!
> WHO CAN HELP A POOR FRUSTRATED JSP DEVELOPER (BEGINNER) ?

Reply via email to