Re: [web2py] Re: postgres connect problem

2012-07-11 Thread Bruce Wade
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 postgrespeer

# TYPE  DATABASEUSERADDRESS METHOD

# "local" is for Unix domain socket connections only
local   all all peer
# IPv4 local connections:
hostall all 127.0.0.1/32md5
# IPv6 local connections:
hostall 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  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


Re: [web2py] Re: postgres connect problem

2012-07-11 Thread lucas
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


Re: [web2py] Re: postgres connect problem

2012-07-11 Thread Bruce Wade
Until trunk is stable I suggest you just install psycopg2 and use that.
Once you install the python driver everything will just work without any
change to your code.

On Wed, Jul 11, 2012 at 1:45 PM, Cliff Kachinske  wrote:

> +1 for psycopg2.  Works fine for me.
>
> I missed that you weren't using it.
>
>
>
> On Wednesday, July 11, 2012 4:40:56 PM UTC-4, lucas wrote:
>>
>> hey wade,
>>
>> yes, i have been banging my head on this one because i have had success
>> with web2py and postgresql for quite a while.  my admin interface says that
>> my "web2py is up to date" and that is currently on version 1.99.7.  so what
>> is the best method toi update my web2py?  i am using centos 6.2 and the
>> "web2py_install" script found at:
>>
>> http://www.web2pyslices.com/**slice/show/1423/deploy-web2py-**
>> on-fedoracentosred-hat
>>
>> 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


Re: [web2py] Re: postgres connect problem

2012-07-11 Thread Cliff Kachinske
+1 for psycopg2.  Works fine for me.

I missed that you weren't using it.



On Wednesday, July 11, 2012 4:40:56 PM UTC-4, lucas wrote:
>
> hey wade,
>
> yes, i have been banging my head on this one because i have had success 
> with web2py and postgresql for quite a while.  my admin interface says that 
> my "web2py is up to date" and that is currently on version 1.99.7.  so what 
> is the best method toi update my web2py?  i am using centos 6.2 and the 
> "web2py_install" script found at:
>
>
> http://www.web2pyslices.com/slice/show/1423/deploy-web2py-on-fedoracentosred-hat
>
> lucas
>


Re: [web2py] Re: postgres connect problem

2012-07-11 Thread lucas
hey wade,

yes, i have been banging my head on this one because i have had success 
with web2py and postgresql for quite a while.  my admin interface says that 
my "web2py is up to date" and that is currently on version 1.99.7.  so what 
is the best method toi update my web2py?  i am using centos 6.2 and the 
"web2py_install" script found at:

http://www.web2pyslices.com/slice/show/1423/deploy-web2py-on-fedoracentosred-hat

lucas


Re: [web2py] Re: postgres connect problem

2012-07-11 Thread Bruce Wade
There is a bug with the version of the web2py you are using update to a
newer version. There has been a few posts in this group about that.

The other solution is to install psycopg2 and use that driver.

On Wed, Jul 11, 2012 at 7:05 AM, Cliff Kachinske  wrote:

> Have you created a postgres user?
> Does the user own the database?
> Does the user have a password?
>
> If not, make these things happen.  A Google search will take you to the
> Postgres manual pages.
>
> If there is a user named "testuser" with a password "testword" then your
> connection string should look like this:
>
> db = DAL('postgres://testuser:testword@localhost:5432/testbank')
>
> Note the 5432.  That's the default postgres connection port.
>
> Undo your changes to the dal code.
>
> On Wednesday, July 11, 2012 8:25:25 AM UTC-4, lucas wrote:
>>
>> and i did "CREATE DATABASE testbank;" under psql and it does exist as an
>> empty database at this point.
>>
>


-- 
-- 
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