First you don't need to write you connection string like this:
db = DAL('postgres:psycopg2://postgres:password@localhost/testbank')
You can use this:
db = DAL('postgres://postgres:password@localhost/testbank')

I always set pg_hba.conf (this is on my development box not my live server)
# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Besides that if your username and password is correct you shouldn't have
any problems.

On Wed, Jul 11, 2012 at 2:29 PM, lucas <sjluk...@gmail.com> wrote:

> ok, i installed the rpm version of psycopg2 and web2py recognizes it when
> i run "python web2py.py".  i then added a very simple application under the
> admin interface and added only:
>
> db = DAL('postgres:psycopg2://postgres:password@localhost/testbank')
>
> to the db.py file.  when i run the "database administration" button, i get
> the error:
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/dal.py", line 5955, in __init__
>     self._adapter = ADAPTERS[self._dbname](*args
> )
>   File "/opt/web-apps/web2py/gluon/dal.py", line 2010, in __init__
>     self.pool_connection(connect)
>   File "/opt/web-apps/web2py/gluon/dal.py", line 465, in pool_connection
>     self.connection = f()
>   File "/opt/web-apps/web2py/gluon/dal.py", line 2009, in connect
>     return self.driver.connect(msg,**driver_args)
>   File "/usr/lib64/python2.6/site-packages/psycopg2/__init__.py", line 179, 
> in connect
>     connection_factory=connection_factory, async=async)
> OperationalError: FATAL:  Ident authentication failed for user "postgres"
>
>
> BUT, BUTTE, psql is totally working and accessing the postgresql service and
> testbank database for the "postgres" user with "trust" or "md5" set to the
> local under pg_hba.conf file and using the proper password.
>
>
> also under python native:
>
> import psycopg2
> conn = psycopg2.connect('dbname=testbank user=postgres password=password')
>
> works fine also with no issues and conn shows a proper connection object.
> so damn, even the psycopg2 driver is working either.
>
> lucas
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com

Reply via email to