Can't connect to PostgreSQL using Remote DB SQL option. (PGSql installed locally)


#1

I have installed the DSP locally on my Mac Book Pro using Bitnani.

I have a PostGreSQL server running locally on my Macbook, which I want to connect to using the DSP.
I am successfully able to connect to my PostGreSQL server from other applications, which essentially means that there is no problem with the setup.
However, on trying to connect the same from DSP I get the error:- “Failed to launch service “sql”: CDbConnection failed to open the DB connection.”

My connection string is :- "pgsql:host=localhost;dbname=Pinu"
Also, the password has been correctly entered.

The port is default as 5432. Whether or not I enter the same in the connection string, the connection always fails.

Even though I am trying to add the service as Remote SQL DB, I know that its actually on the same local host. Not sure if that is the issue.

I also tried entering - 127.0.0.1 in place of localhost, but still I see the same issue.

Any help in this regard would be highly appreciated !

P.S:- I was trying to upload the screenshot, but since I am a new user, I am not being allowed to do so.


DSP Remote SQL DB went down on Amazon EC2
#2

I’ve updated your question on StackOverflow. Please take a look when you’ve got a chance, then reach out to me and we can get your upgrade situation squared away.

Thanks.


#3

I installed PostGreSQL on cloud, but even now I see the same error in the locally installed DSP module on Bitnami.
I am on 1.8.2 on Mac OS X.

I get the same CDbConnection error that I had reported couple of months back in the initial post.
But I did not get a closure or support on that yet.


#4

Hi @praveen, could you let me know what is logged in your *.log file in the Bitnami/dreamfactory1.8.2-1/apps/dreamfactory/htdocs/log/ directory when you receive the 500 error connecting to your DB?


#5

This is the error I see in the lowgs, on clicking on Schema:-

[2014-12-17 09:30:41][app][ERROR ] REST Exception #500 > Failed to launch service “sql”: CDbConnection failed to open the DB connection. {“host”:“praveens-macbook-pro.local:8080”,“request_uri”:"/rest/sql/_schema",“source_ip”:“192.168.1.36”,“sapi_name”:“apache2handler”}
[2014-12-17 09:30:41][app][ERROR ] could not find driver


#6

So we now know it’s either a driver missing, not properly installed, or not properly being called.

Could you please run which php to ensure you’re using the php from Bitnami/dreamfactory1.8.2-1/php/ and then run php -m and post the result? I want to ensure the pdo_pgsql and pgsql modules are installed and active. If you have a chance, running php -i | grep pgsql may provide some additional insight.


#7

@jeffreystables
Yes, I guess you nailed it May be the correct PHP is not being used.
In that case the installation process needs to be updated, so that it uses the correct PHP.

Below is the output of the commands you asked me to fire:-

Praveens-MacBook-Pro:~ Pinu$ which php
/usr/bin/php
Praveens-MacBook-Pro:~ Pinu$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
hash
iconv
json
ldap
libxml
mbstring
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]

Praveens-MacBook-Pro:~ Pinu$ php -i | grep pgsql
Praveens-MacBook-Pro:~ Pinu$


#8

@jeffreystables
Any updates on this one please?


#9

@jeffreystables … any updates please?


#10

You did not report the settings from the Bitnami PHP, so I have no insight for you on the enabled modules.

Typically with the error “could not find driver” you either are missing pdo_pgsql.so and pgsql.so in your Bitnami PHP extensions directory, or you are missing/commented out extension=pgsql.so and extension=pdo_pgsql.so in your Bitnami PHP’s php.ini, or you did not restart your Bitnami instance after doing either.


#11

@jeffreystables
I am not sure which settings are you looking for.
I ran all the commands and steps you asked for and have pasted the result of the same.

I have a Mamp Stack installed on my Local machine, and the issue persists.

Can you please let me know which exact folder content you are looking for?
Or what command I need to fire?


#12

No problem. Please ensure you have pdo_pgsql.so and pgsql.so in your Bitnami PHP’s extensions directory, that you have commented out extension=pgsql.so and extension=pdo_pgsql.so in your Bitnami PHP’s php.ini, and then restart the Bitnami servers. Exact folder locations will always depend on where you’ve installed your Bitnami instance.


#13

@jeffreystables
I neither have these two .so files in my extension directory nor do I have these extensions in my php.ini file to comment out.

I have installed MAMP Stack from Bitnami.
I am not sure if I am supposed to be having these files and extensions etc by default. If not, then please let me know if these are to be done externally.

Also, please note that it works fine on Amazon EC2 instance by default. Could it be that it has been configured fine over there, but not on their downloadable instances.
Please let me know the next steps.


Please note that I just checked my Amazon EC2 instance. It has these files that you are talking of. May be that is the reason its working fine there.


#14

Odd. I installed a brand new Bitnami DSP on my testing Mac (OS X 10.7.5) in /Applications/dreamfactory1.8.2-1/ and under /Applications/dreamfactory1.8.2-1/php/lib/php/extensions/ I have both pdo_pgsql.so and pgsql.so. These drivers are definitely supposed to be included with all Bitnami installs, so I recommend you first download and install a new Bitnami instance on your Mac. You will not be able to connect to PostgreSQL without both drivers.

Bitnami also offers the PostgreSQL module as an add-on to the MAMP stack since yours somehow came without it. Here’s the link in case you want to try it instead of just installing a new DSP: https://bitnami.com/stack/mamp/modules (just type “postgresql” in the Search box).


#15

@praveen I just installed a PostgreSQL DB on my Mac, set up a single user, and connected to it from my Mac DSP install immediately. I know for sure this works. Be sure to have the drivers installed, uncomment the extensions in your php.ini, and restart your Bitnami servers.

Also make sure PostgreSQL is running, but of course that’s not something related to the DSP.