Thread: How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?
How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?
Hey guys, I'm trying to get a VB program to make a client connection to my PostgreSQL server running on an
Ubuntu 10.10 server.
Here's what I've done:
Client side - installed and registered the OLE DB .dll's from the PostgreSQL OLE DB Provider project.
server side -
the configuration described here: https://help.ubuntu.com/10.10/serverguide/C/postgresql.html
---------------
Have added this line to postgresql.conf:
listen_addresses = '*, 144.96.80.35, localhost'
I've also tried this as simply:
listen_addresses = '144.96.80.35, localhost'
also, port = 5432
--------------
I have added the following to pg_hba.conf:
# IPv4 local connections:
host all all 144.96.80.35 255.255.255.0 md5
local all postgres md5
--------------
I've got the following code going in VB:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const connString As String = "Provider=PostgreSQL; Server=144.96.80.35; User Id=postgres;Password=postgres;"
Dim theOleDBconnection As New OleDb.OleDbConnection
theOleDBconnection.ConnectionString = connString
theOleDBconnection.Open()
End Sub
End Class
So when the project opens up, it should make the connection and display the form.
What happens is that I get an error...
OleDbException was unhandled
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "" and accepting
TCP/IP connections on port 5432?
---------------------------
So, obviously I've got something configured incorrectly.
I'm troubled that the VB error seems to show a null value for the host. Shouldn't that be the Server value in
the connection string?
Thanks to all for any help…
Re: How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?
On 03/09/2011 08:30 AM, John Edens wrote: > Hey guys, I'm trying to get a VB program to make a client connection to > my PostgreSQL server running on an > > Ubuntu 10.10 server. > > Here's what I've done: > > Client side - installed and registered the OLE DB .dll's from the > PostgreSQL OLE DB Provider project. > > server side - > > the configuration described here: > https://help.ubuntu.com/10.10/serverguide/C/postgresql.html > > --------------- > > Have added this line to postgresql.conf: > > listen_addresses = '*, 144.96.80.35, localhost' I would stick with listen_addresses = '*', this covers all the bases and simplifies things for the time being. > > I've also tried this as simply: > > listen_addresses = '144.96.80.35, localhost' > > also, port = 5432 > > -------------- > > I have added the following to pg_hba.conf: > > # IPv4 local connections: > > host all all 144.96.80.35 255.255.255.0 md5 > > local all postgres md5 If I am following, 144.96.80.35 is your server address not the clients. In pg_hba.conf the IPs are those from the clients you want to let in, so you will need to use an IP or mask that matches that of your client. To reduce confusion you might want to do that in the section for remote connections :) > > -------------- > > I've got the following code going in VB: > > Public Class Form1 > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > > Const connString As String = "Provider=PostgreSQL; Server=144.96.80.35; > User Id=postgres;Password=postgres;" > > Dim theOleDBconnection As New OleDb.OleDbConnection > > theOleDBconnection.ConnectionString = connString > > theOleDBconnection.Open() > > End Sub > > End Class > > So when the project opens up, it should make the connection and display > the form. > > What happens is that I get an error... > > OleDbException was unhandled > > could not connect to server: Connection refused (0x0000274D/10061) Per the explanation above your client IP does not have access to the server. > > Is the server running on host "" and accepting > > TCP/IP connections on port 5432? > > --------------------------- > > So, obviously I've got something configured incorrectly. > > I'm troubled that the VB error seems to show a null value for the host. > Shouldn't that be the Server value in > > the connection string? > > Thanks to all for any help… > -- Adrian Klaver adrian.klaver@gmail.com
Re: How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?
>If I am following, 144.96.80.35 is your server address not the clients. >In pg_hba.conf the IPs are those from the clients you want to let in, so >you will need to use an IP or mask that matches that of your client. To >reduce confusion you might want to do that in the section for remote >connections :) >Per the explanation above your client IP does not have access to the server. Okay, I have set the mask as described... I can now use pgAdmin III to access the database on the server from my desktop machine, which I could not previously do. However, the VB code still gives the error previously described. Thanks for the config file help - any ideas about the OLE DB connection problem?
Re: How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?
On 03/09/2011 09:59 AM, John Edens wrote: >> If I am following, 144.96.80.35 is your server address not the clients. >> In pg_hba.conf the IPs are those from the clients you want to let in, so >> you will need to use an IP or mask that matches that of your client. To >> reduce confusion you might want to do that in the section for remote >> connections :) > >> Per the explanation above your client IP does not have access to the > server. > > Okay, I have set the mask as described... > > I can now use pgAdmin III to access the database on the server from my > desktop machine, which I could not previously do. > > However, the VB code still gives the error previously described. > > Thanks for the config file help - any ideas about the OLE DB connection > problem? > What I know about OLE would fit in the navel of a flea:) That being said I offer: http://www.connectionstrings.com/postgre-sql#p53 It would seem your connection string needs different information. -- Adrian Klaver adrian.klaver@gmail.com
Re: How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?
That's a great site - I am now making a connection. Thanks for all the help! John -----Original Message----- From: Adrian Klaver [mailto:adrian.klaver@gmail.com] Sent: Wednesday, March 09, 2011 12:28 PM To: John Edens Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's? On 03/09/2011 09:59 AM, John Edens wrote: >> If I am following, 144.96.80.35 is your server address not the clients. >> In pg_hba.conf the IPs are those from the clients you want to let in, >> so you will need to use an IP or mask that matches that of your >> client. To reduce confusion you might want to do that in the section >> for remote connections :) > >> Per the explanation above your client IP does not have access to the > server. > > Okay, I have set the mask as described... > > I can now use pgAdmin III to access the database on the server from my > desktop machine, which I could not previously do. > > However, the VB code still gives the error previously described. > > Thanks for the config file help - any ideas about the OLE DB > connection problem? > What I know about OLE would fit in the navel of a flea:) That being said I offer: http://www.connectionstrings.com/postgre-sql#p53 It would seem your connection string needs different information. -- Adrian Klaver adrian.klaver@gmail.com