connection problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolminded
    New Member
    • Mar 2007
    • 137

    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=Postg reSQL30;uid=pos tgres;pwd='post gres@132'")
    End Sub

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

    can anybody suggest ?
    with regards
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    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=Postg reSQL30;uid=pos tgres;pwd='post gres@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
    Code:
    psql -h 127.0.0.1 -U postgres db_test
    what is the error message if not? Are you sure the postgres has set a password, you can check it in pg_user view.

    Comment

    • coolminded
      New Member
      • Mar 2007
      • 137

      #3
      Originally posted by rski
      Can you connect to postgres via command line
      Code:
      psql -h 127.0.0.1 -U postgres db_test
      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.

      Comment

      • rski
        Recognized Expert Contributor
        • Dec 2006
        • 700

        #4
        i'm not a vb6 specialist but is it right wrtting ' ' here
        Code:
        pwd='postgres@1 32'
        (space in password value you wrote by mistake i suppose).
        Is postgres loggin something when connect failed (did you configue detailed logs?)

        Comment

        • coolminded
          New Member
          • Mar 2007
          • 137

          #5
          Originally posted by rski
          i'm not a vb6 specialist but is it right wrtting ' ' here
          Code:
          pwd='postgres@1 32'
          (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@1 32", 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

          Comment

          • rski
            Recognized Expert Contributor
            • Dec 2006
            • 700

            #6
            Originally posted by coolminded
            hi rski,
            actually, the password is "postgres@1 32", 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' ?

            Comment

            • coolminded
              New Member
              • Mar 2007
              • 137

              #7
              Originally posted by rski
              to be clear password is postgres@132 or 'postgres@132' ?
              the password is just

              pwd = postgres@132

              Comment

              • rski
                Recognized Expert Contributor
                • Dec 2006
                • 700

                #8
                Originally posted by coolminded
                the password is just

                pwd = postgres@132
                So why you write here
                Code:
                Public Sub getconnect()
                Set ws = CreateWorkspace("", "cdef", "", dbUseODBC)
                Set dbaccount = ws.OpenDatabase("", , False, "ODBC;dsn=PostgreSQL30;uid=postgres;pwd='postgres@1 32'")
                End Sub
                pwd='postgres@1 32' ?
                shouldn't it be
                pwd=postgres@13 2 (without apos)?

                If VB needs that syntax sorry for my lack of knolwdge.

                Comment

                • coolminded
                  New Member
                  • Mar 2007
                  • 137

                  #9
                  Originally posted by rski
                  So why you write here
                  Code:
                  Public Sub getconnect()
                  Set ws = CreateWorkspace("", "cdef", "", dbUseODBC)
                  Set dbaccount = ws.OpenDatabase("", , False, "ODBC;dsn=PostgreSQL30;uid=postgres;pwd='postgres@1 32'")
                  End Sub
                  pwd='postgres@1 32' ?
                  shouldn't it be
                  pwd=postgres@13 2 (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.

                  Comment

                  Working...