Install question on Mac Leopard Server 10.5
I am just getting started with PostgreSQL. I've installed PostgreSQL
8.3.5-1 on a MacPro server running Leopard Server 105.5
I can connect to the database with PGAdmin on the server, but I can't
access the database from another Mac on my network. I get the
following error message:
I've done the following:
- checked the postgresql.conf file for listen_addresses, it's set to
'*'
- modified the pg_hba.conf file to allow traffice from the network in
my office.
- made sure my OS X Server Firewall has a hole for the port to be used.
What am I missing? Any help would be greatly appreciated...
Steve Henry
San Diego Mac IT
On Nov 29, 2008, at 3:56 PM, Steve Henry wrote:
I am just getting started with PostgreSQL. I've installed
PostgreSQL 8.3.5-1 on a MacPro server running Leopard Server 105.5I can connect to the database with PGAdmin on the server, but I
can't access the database from another Mac on my network. I get the
following error message:I've done the following:
- checked the postgresql.conf file for listen_addresses, it's set
to '*'- modified the pg_hba.conf file to allow traffice from the network
in my office.- made sure my OS X Server Firewall has a hole for the port to be
used.What am I missing? Any help would be greatly appreciated...
Steve Henry
San Diego Mac IT
What did you do so far??
1) is PG listening now to all interfaces??
2) Did you modify your pg_hba.conf accordingly already??
3) DO you have a firewall that might block incoming requests on port
5432??
regards, Ries van Twisk
-------------------------------------------------------------------------------------------------
Ries van Twisk
tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS
WebORB PostgreSQL DB-Architect
email: ries@vantwisk.nl
web: http://www.rvantwisk.nl/
skype: callto://r.vantwisk
On Nov 29, 2008, at 4:05 PM, ries van Twisk wrote:
On Nov 29, 2008, at 3:56 PM, Steve Henry wrote:
I am just getting started with PostgreSQL. I've installed
PostgreSQL 8.3.5-1 on a MacPro server running Leopard Server 105.5I can connect to the database with PGAdmin on the server, but I
can't access the database from another Mac on my network. I get
the following error message:I've done the following:
- checked the postgresql.conf file for listen_addresses, it's set
to '*'- modified the pg_hba.conf file to allow traffice from the network
in my office.- made sure my OS X Server Firewall has a hole for the port to be
used.What am I missing? Any help would be greatly appreciated...
Steve Henry
San Diego Mac ITWhat did you do so far??
1) is PG listening now to all interfaces??
2) Did you modify your pg_hba.conf accordingly already??
3) DO you have a firewall that might block incoming requests on port
5432??
Sorry, didn't read the initial mail correctly...
Did you restart PostgreSQL?
Ries
Steve Henry wrote:
I am just getting started with PostgreSQL. I've installed PostgreSQL
8.3.5-1 on a MacPro server running Leopard Server 105.5I can connect to the database with PGAdmin on the server, but I can't
access the database from another Mac on my network. I get the following
error message:I've done the following:
- checked the postgresql.conf file for listen_addresses, it's set to
'*'
This will most likely be fine unless you have a complex network setup
- modified the pg_hba.conf file to allow traffice from the network
in my office.
You will find pg_hba.conf in the data folder. You need a line in this
file that allows connections from your clients ip addresses something like -
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 192.168.1.0/24 md5
The file itself has plenty of info.
- made sure my OS X Server Firewall has a hole for the port to be used.
If you have missed this then you need to open port 5432 on your firewall.
What am I missing? Any help would be greatly appreciated...
--
Shane Ambler
pgSQL (at) Sheeky (dot) Biz
Get Sheeky @ http://Sheeky.Biz
The following libpq code chokes on me with invalid input to an
integer parameter (state == PGRES_FATAL_ERR aPtr == "Error: Invalid
Input syntax for integer """ . It fails on the call to
PQexecPrepared. I suspect I'm not doing the parameters right. Can
anyone spot anything wrong?
Thanks,
-Owen
char * getPicture(PGconn * myconnection, char * maplot, int unitno, int bldgno)
{
PGresult * resultant;
Oid paramTypes[3] = { 25, 23, 23 };
ExecStatusType state;
char * sqlquery = "Select image from images where maplot = $1
and unitno = $2 and imageno = $3";
const char * myparamValues[3];
char * aPtr;
myparamValues[0] = maplot;
myparamValues[1] = &unitno;
myparamValues[2] = &bldgno;
resultant = PQprepare(myconnection, "pictureplan", sqlquery ,
3, paramTypes);
if (PQresultStatus(resultant) == PGRES_COMMAND_OK)
{
resultant = PQexecPrepared( myconnection,
"pictureplan", 3, myparamValues, NULL, NULL, 1);
if (PQresultStatus(resultant) == PGRES_TUPLES_OK)
{
aPtr = PQgetvalue(resultant, 0, 0);
return aPtr;
}
else
{
state = PQresultStatus(resultant);
aPtr = PQresultErrorMessage(resultant);
}
}
else
{
state = PQresultStatus(resultant);
aPtr = PQresultErrorMessage(resultant);
}
return NULL;
}
Owen Hartnett <owen@clipboardinc.com> writes:
The following libpq code chokes on me with invalid input to an
integer parameter (state == PGRES_FATAL_ERR aPtr == "Error: Invalid
Input syntax for integer """ . It fails on the call to
PQexecPrepared. I suspect I'm not doing the parameters right. Can
anyone spot anything wrong?
You can't just point to integers as if they were strings. Didn't
your compiler complain about that?
regards, tom lane
At 11:45 PM -0500 11/29/08, Tom Lane wrote:
Owen Hartnett <owen@clipboardinc.com> writes:
The following libpq code chokes on me with invalid input to an
integer parameter (state == PGRES_FATAL_ERR aPtr == "Error: Invalid
Input syntax for integer """ . It fails on the call to
PQexecPrepared. I suspect I'm not doing the parameters right. Can
anyone spot anything wrong?You can't just point to integers as if they were strings. Didn't
your compiler complain about that?regards, tom lane
Yes, it did. I'm confused. My first parameter is a string, but the
following two are integers. I thought the paramType parameter
indicated the type. Do the integers need to be sprintf'd to strings?
There's only one paramValues array and it's type is a const char *
array.
-Owen
Owen Hartnett <owen@clipboardinc.com> writes:
Yes, it did. I'm confused. My first parameter is a string, but the
following two are integers. I thought the paramType parameter
indicated the type. Do the integers need to be sprintf'd to strings?
Yes.
Alternatively, you could pass the integers as binary, but that's not
notation-free either (you need htonl or some such).
regards, tom lane
At 1:26 PM -0500 11/30/08, Tom Lane wrote:
Owen Hartnett <owen@clipboardinc.com> writes:
Yes, it did. I'm confused. My first parameter is a string, but the
following two are integers. I thought the paramType parameter
indicated the type. Do the integers need to be sprintf'd to strings?Yes.
Alternatively, you could pass the integers as binary, but that's not
notation-free either (you need htonl or some such).regards, tom lane
Thanks, that did it. I got confused with the binary parameters, and
PQgetvalue returning the binary through a char * when it returns a
binary value.
-Owen
On Mon, Dec 1, 2008 at 12:10 AM, Owen Hartnett <owen@clipboardinc.com> wrote:
At 1:26 PM -0500 11/30/08, Tom Lane wrote:
Owen Hartnett <owen@clipboardinc.com> writes:
Yes, it did. I'm confused. My first parameter is a string, but the
following two are integers. I thought the paramType parameter
indicated the type. Do the integers need to be sprintf'd to strings?Yes.
Alternatively, you could pass the integers as binary, but that's not
notation-free either (you need htonl or some such).regards, tom lane
Thanks, that did it. I got confused with the binary parameters, and
PQgetvalue returning the binary through a char * when it returns a binary
value.
you may want to check out libpqtypes:
http://libpqtypes.esilo.com/
http://pgfoundry.org/projects/libpqtypes/
merlin