Re: Connecting to Postgres using Windows 7

From: "George Weaver" <gweaver(at)cleartagsoftware(dot)com>
To: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Cc: "Geoffrey Becker" <geoff(dot)becker100(at)gmail(dot)com>
Subject: Re: Connecting to Postgres using Windows 7
Date: 2011-05-20 14:01:57
Message-ID: 24C2EC5A5D144BB0B00D47E4FEE87D61@D420
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>----- Original Message -----
>From: Geoffrey Becker

>I'm relatively new to postgres. I've got a Visual Basic (VB)
>application that i would like to connect to a Postgres database using
>ODBC . Both the VB application and postgres are on my laptop and both
>work beautifully independent of each other. Trouble is, I have a
>windows 7 64bit OS and therefore I have been unable to get VB to connect
>to the database. My code is as follows:

> Public Class Form1

> Dim cCon As ADODB.Connection

> Private Sub Button1_Click(ByVal sender As System.Object, ByVal
>e As System.EventArgs) Handles Button1.Click

> On Error GoTo EH

> cCon.ConnectionString =
>"DSN=MyDatabase;uid=MyUserID;pwd=MyPassword"

Is this your actual connection string? If your using a DSN does it
specify the Server Name and Port where PostgreSQL is listening?

See: http://www.connectionstrings.com/postgre-sql

> cCon.Open()
> MsgBox("O.K.", vbInformation, "Connection Message")
> Exit Sub
> EH:
> MsgBox(Err.Description, vbCritical, "Error Message")
> End Sub

> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
>As System.EventArgs) Handles MyBase.Load
> cCon = New ADODB.Connection
> End Sub
> End Class

>When I try to connect, all I get is a "Server does not exist or access
>is denied" error. I've tried configuring ODBC using odbcad32.exe as it
>seems that is necessary on a 64 bit OS, but I'm not sure if that even
>the right way to go.

You may need to install the psqlODBC 64 bit driver if you trying to connect
from a 64 bit machine.

>Any help i could get would be much appreciated.

>Thanks,

>Geoff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jack Christensen 2011-05-20 14:48:45 Re: implementing check-in/check-out of an items table
Previous Message salah jubeh 2011-05-20 13:57:13 Fw: Views permessions