By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,376 Members | 3,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,376 IT Pros & Developers. It's quick & easy.

connection problem

100+
P: 138
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
Apr 18 '08 #1
Share this Question
Share on Google+
8 Replies


Expert 100+
P: 700
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.
Apr 18 '08 #2

100+
P: 138
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.
Apr 18 '08 #3

Expert 100+
P: 700
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?)
Apr 18 '08 #4

100+
P: 138
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
Apr 20 '08 #5

Expert 100+
P: 700
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' ?
Apr 20 '08 #6

100+
P: 138
to be clear password is postgres@132 or 'postgres@132' ?
the password is just

pwd = postgres@132
Apr 21 '08 #7

Expert 100+
P: 700
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.
Apr 21 '08 #8

100+
P: 138
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.
Apr 21 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.