I used your code:
from pyPgSQL import PgSQL
db =
PgSQL.connect('postgresql_IP::database_name:user_login:password_for_user_in_postgresql::')
cursor = db.cursor()
cursor.execute("select * from xamemails WHERE aclcomment = 'Virus
Detected'")
result = cursor.fetchall()
for row in result:
print row.tstamp, row.tx, row.rx
... and it works like a champ - thanks! FAQ for newbies:
[1] Make sure the locate pg_hba.conf file on the server is correct for
your system/workstation.
[2] Make sure the username you use for PostgreSQL has a password
assigned to it before you use it in your code.
[3] In the Windows version, and interpreter for Python is also an
editor. Watch out for being in the wrong 'mode'.
[4] In the Windows version, you need to save your file before you press
F5 and run it.
>>> Michael Watkins <wa...@tr...> 06/13/02 07:04PM >>>
At 04:29 PM 6/13/2002 -0400, Dave Strickler wrote:
> > I tried to to this, and the "from" command worked, and I got a lot
> > further. But, as you can see from below, it wasn't 100% sucsessful.
Any
> > clues as to what is going wrong? I made a pg_hba.conf in the PgSQL
> > directory, and added in my 10.0.0.120 address (that's my
workstation),
> > but it didn't help.
You are getting close but not quite...
Note!! pg_hba.conf does not go in the PgSQL directory... but in your
PostgreSQL server's **data** directory... something like
/usr/local/pgsql/data if you have not moved it. Try at the command line
locate pg_hba.conf
which should show you the path to some sample and the actual conf file.
In that file have:
host all 10.0.0.120 255.255.255.0 trust
... for now, just to be sure authentication isn't an issue.
|