I am trying to access a remote database of postgresql. I am working in a python project
I am able to access a table using psycopg2
import psycopg2
server_host = 'xx.x.xx.xx'
server_dbname = 'dbname'
server_username = 'username'
server_password = 'password'
connection_for_data_and_variables = psycopg2.connect(host=server_host, database=server_dbname, user=server_username, password=server_password)
cursor = connection_for_data_and_variables.cursor()
cursor.execute('SELECT r1, r2 FROM tablename WHERE t1=%s ORDER BY id DESC LIMIT 1;', ("Test", ))
a = cursor.fetchone()
I have the following in the /usr/share/webapps/phppgadmin/conf/config.inc.php
of phpmyadmin
// Example for a second server (PostgreSQL for Windows)
$conf['servers'][1]['desc'] = 'Test Server';
$conf['servers'][1]['host'] = 'xx.x.xx.xx';
$conf['servers'][1]['port'] = 5432;
//$conf['servers'][1]['sslmode'] = '';
$conf['servers'][1]['defaultdb'] = 'template1';
$conf['servers'][1]['pg_dump_path'] = '';
$conf['servers'][1]['pg_dumpall_path'] = '';
When i try to login i get:
Also apache configuration:
/etc/httpd/conf/extra/phppgadmin.conf
Alias /phppgadmin "/usr/share/webapps/phppgadmin"
<Directory "/usr/share/webapps/phppgadmin">
DirectoryIndex index.php
AllowOverride All
Options FollowSymlinks
Require all granted
</Directory>