opkg update opkg install python-psycopg
nano postgre.py
#!/usr/bin/python # -*- coding: utf-8 -*- import psycopg try: conn = psycopg.connect("dbname='mypgdatabase' user='postgres' host='192.168.0.240' password='password'") except: print "I am unable to connect to the database" cur = conn.cursor() cur.execute("select username,password from login") rows = cur.fetchall() print "\nShow me the databases:\n" for row in rows: print " ", row[0], " ", row[1]
chmod 755 postgre.py
./postgre.py
Comments powered by CComment