I'm not really sure what I've done but mine is working as I read the documentation. in my case it's MySQL and I am using Tomcat 7.
copy the correct VERSION of the PHP extension "php_mysql.dll" to the correspond "ext" directory, in my case it's in "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\aeu\WEB-INF\cgi\amd64-windows\ext"
uncomment/add this line,
extension = php_mysql.dll
in php.ini and mysql.ini file, in my case there're as C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\aeu\WEB-INF\cgi\amd64-windows\php.ini and C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\aeu\WEB-INF\cgi\amd64-windows\conf.d\mysql.ini
and lastly restart Tomcat. good luck.