Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old April 18th, 2008, 09:41 AM
Member
 
Join Date: Mar 2007
Posts: 106
Default connection problem

hi,
i'm using vb6 as a front end and postgresql 8.0.0 as a backend. i just configured the pg_hba.conf file. i changed the method to "md5" and in the database, i gave the name of database. but when i connect with my application, it shows runtime error -3146 , odbc--call failed.

my pg_hba.conf file is as

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
#host all all 127.0.0.1/32 md5
host db_test postgres 127.0.0.1/32 md5

# IPv6 local connections:
#host all all ::1/128 md5

in my application, i put the password 'postgres@132' that i used while installing the postgres.

my connection string is

Public Sub getconnect()
Set ws = CreateWorkspace("", "cdef", "", dbUseODBC)
Set dbaccount = ws.OpenDatabase("", , False, "ODBC;dsn=PostgreSQL30;uid=postgres;pwd='postgres@ 132'")
End Sub

when i use trust instead of md5 in method in pg_hba.conf, it runs well.

can anybody suggest ?
with regards
Reply
  #2  
Old April 18th, 2008, 10:10 AM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

Quote:
Originally Posted by coolminded
hi,
i'm using vb6 as a front end and postgresql 8.0.0 as a backend. i just configured the pg_hba.conf file. i changed the method to "md5" and in the database, i gave the name of database. but when i connect with my application, it shows runtime error -3146 , odbc--call failed.

my pg_hba.conf file is as

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
#host all all 127.0.0.1/32 md5
host db_test postgres 127.0.0.1/32 md5

# IPv6 local connections:
#host all all ::1/128 md5

in my application, i put the password 'postgres@132' that i used while installing the postgres.

my connection string is

Public Sub getconnect()
Set ws = CreateWorkspace("", "cdef", "", dbUseODBC)
Set dbaccount = ws.OpenDatabase("", , False, "ODBC;dsn=PostgreSQL30;uid=postgres;pwd='postgres@ 132'")
End Sub

when i use trust instead of md5 in method in pg_hba.conf, it runs well.

can anybody suggest ?
with regards
Can you connect to postgres via command line
Expand|Select|Wrap|Line Numbers
  1. psql -h 127.0.0.1 -U postgres db_test
  2.  
what is the error message if not? Are you sure the postgres has set a password, you can check it in pg_user view.
Reply
  #3  
Old April 18th, 2008, 11:58 AM
Member
 
Join Date: Mar 2007
Posts: 106
Default

Quote:
Originally Posted by rski
Can you connect to postgres via command line
Expand|Select|Wrap|Line Numbers
  1. psql -h 127.0.0.1 -U postgres db_test
  2.  
what is the error message if not? Are you sure the postgres has set a password, you can check it in pg_user view.

it asks for the password and when supplied ,it connects to the database db_test from the command line and it also shows the password in the pg_user.
Reply
  #4  
Old April 18th, 2008, 12:19 PM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

i'm not a vb6 specialist but is it right wrtting ' ' here
Expand|Select|Wrap|Line Numbers
  1. pwd='postgres@1 32' 
  2.  
(space in password value you wrote by mistake i suppose).
Is postgres loggin something when connect failed (did you configue detailed logs?)
Reply
  #5  
Old April 20th, 2008, 05:37 AM
Member
 
Join Date: Mar 2007
Posts: 106
Default

Quote:
Originally Posted by rski
i'm not a vb6 specialist but is it right wrtting ' ' here
Expand|Select|Wrap|Line Numbers
  1. pwd='postgres@1 32' 
  2.  
(space in password value you wrote by mistake i suppose).
Is postgres loggin something when connect failed (did you configue detailed logs?)

hi rski,
actually, the password is "postgres@132", it's not "postgres@1 32".
it asks password while connecting to server in postgres and after the correct password is provided, it allows to connect
but it doesn't allow me to connect through vb6.

with regards,
coolminded
Reply
  #6  
Old April 20th, 2008, 06:16 PM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

Quote:
Originally Posted by coolminded
hi rski,
actually, the password is "postgres@132", it's not "postgres@1 32".
it asks password while connecting to server in postgres and after the correct password is provided, it allows to connect
but it doesn't allow me to connect through vb6.

with regards,
coolminded
to be clear password is postgres@132 or 'postgres@132' ?
Reply
  #7  
Old April 21st, 2008, 05:32 AM
Member
 
Join Date: Mar 2007
Posts: 106
Default

Quote:
Originally Posted by rski
to be clear password is postgres@132 or 'postgres@132' ?
the password is just

pwd = postgres@132
Reply
  #8  
Old April 21st, 2008, 06:18 AM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

Quote:
Originally Posted by coolminded
the password is just

pwd = postgres@132
So why you write here
Expand|Select|Wrap|Line Numbers
  1. Public Sub getconnect()
  2. Set ws = CreateWorkspace("", "cdef", "", dbUseODBC)
  3. Set dbaccount = ws.OpenDatabase("", , False, "ODBC;dsn=PostgreSQL30;uid=postgres;pwd='postgres@1 32'")
  4. End Sub
  5.  
pwd='postgres@132' ?
shouldn't it be
pwd=postgres@132 (without apos)?

If VB needs that syntax sorry for my lack of knolwdge.
Reply
  #9  
Old April 21st, 2008, 11:27 AM
Member
 
Join Date: Mar 2007
Posts: 106
Default

Quote:
Originally Posted by rski
So why you write here
Expand|Select|Wrap|Line Numbers
  1. Public Sub getconnect()
  2. Set ws = CreateWorkspace("", "cdef", "", dbUseODBC)
  3. Set dbaccount = ws.OpenDatabase("", , False, "ODBC;dsn=PostgreSQL30;uid=postgres;pwd='postgres@1 32'")
  4. End Sub
  5.  
pwd='postgres@132' ?
shouldn't it be
pwd=postgres@132 (without apos)?

If VB needs that syntax sorry for my lack of knolwdge.
thanx for the reply. mistakely i put extra ( ' ' ) apostrophy in the pwd field.
thanx once again to correct my mistake
with regards
coolminded.
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles