You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Marc Weber (H2Opilot)" <we...@h2opilot.de> on 2001/08/20 12:43:32 UTC

problems while trying to initialize a Connectionpool

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) ?