掲示板

PHP Portlets connecting to a 2nd database

13年前 に paul hendrick によって更新されました。

PHP Portlets connecting to a 2nd database

New Member 投稿: 3 参加年月日: 11/03/10 最新の投稿
I'm trying to write a php portlet which connects to a postgres database (a separate db from lportal), but when calling the db connection function (pg_connect), the portlet returns:


/Liferay/liferay-portal-6.0.6/tomcat-6.0.29/webapps/navigation/index.php:17: Warning: A link to the server could not be established. java.lang.ClassCastException: org.postgresql.Driver cannot be cast to javax.sql.DataSource [pg_connect] 


I've had a look for similar issues and found a couple of articles, but they both address liferay 5.*

https://www.liferay.com/community/wiki/-/wiki/Main/PHP+Portlets;jsessionid=92810EB9EDE4D698848021761E8E89B0.node-1#section-PHP+Portlets-AdvancedPHPPortletDevelopment

http://www.liferay.com/community/forums/-/message_boards/message/3760597

Any thoughts on this?
Thanks.
13年前 に paul h によって更新されました。

RE: PHP Portlets connecting to a 2nd database

New Member 投稿: 3 参加年月日: 11/03/10 最新の投稿
Just thought I'd add that trying to do the same thing using mysql (in php code) works fine.

Is it possible that the org.postgresql.Driver class that comes with tomcat doesn't support this?
12年前 に Jim Mlodgenski によって更新されました。

RE: PHP Portlets connecting to a 2nd database

New Member 投稿: 1 参加年月日: 11/07/16 最新の投稿
I just ran across the same problem. I was able to resolve it by upgrading the version of quercus that is shipped with liferay. I just dropped in the latest version (4.0.18) and pg_connect stopped throwing the exception.
12年前 に paul h によって更新されました。

RE: PHP Portlets connecting to a 2nd database

New Member 投稿: 3 参加年月日: 11/03/10 最新の投稿
Oh cool, thanks Jim.
I'd tried my PHP code with the stand-alone Quercus, but not had time to try updating the module in Liferay.