Unable to use DataSource in struts 1.3.10
Code where I tried to make connection: 

DataSource ds = (DataSource)servlet.getServletContext().getAttribute("dbSource");
 System.out.println("ds1 : "+ds);
	        try
	        {
		     Connection conn = (Connection) ds.getConnection();
		     target=login(userName, password,request,conn);
	        } 
	        catch (SQLException e) 
		{
		// TODO Auto-generated catch block
			e.printStackTrace();
		}


And <data-source> from Struts-Config.xml.

<data-source type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" key="dbSource" >
            <set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
            <set-property property="url" value="jdbc:mysql://192.168.10.57:3306/stocks" />
            <set-property property="user" value="admin" />
            <set-property property="password" value="admin" />
            <set-property property="defaultAutoCommit" value="true" />
            <set-property property="defaultReadOnly" value="false" />
            <set-property property="maxActive" value="10" />
            <set-property property="maxWait" value="5000" />
</data-source>
Unable to use DataSource in struts 1.3.10
===

Code where I tried to make connection: 

DataSource ds = (DataSource)servlet.getServletContext().getAttribute("dbSource");
 System.out.println("ds1 : "+ds);
	        try
	        {
		     Connection conn = (Connection) ds.getConnection();
		     target=login(userName, password,request,conn);
	        } 
	        catch (SQLException e) 
		{
		// TODO Auto-generated catch block
			e.printStackTrace();
		}


And <data-source> from Struts-Config.xml.

<data-source type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" key="dbSource" >
            <set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
            <set-property property="url" value="jdbc:mysql://192.168.10.57:3306/stocks" />
            <set-property property="user" value="admin" />
            <set-property property="password" value="admin" />
            <set-property property="defaultAutoCommit" value="true" />
            <set-property property="defaultReadOnly" value="false" />
            <set-property property="maxActive" value="10" />
            <set-property property="maxWait" value="5000" />
</data-source>