How to change port in RDD contrib ?

151 views
Skip to first unread message

Vlad

unread,
May 20, 2013, 9:55:10 AM5/20/13
to harbou...@googlegroups.com
Hi

I installed
postgres on the door that is not the norm. And I want to change the RDD. Only it did not.


My situation is:

My postgres "listens" on port 5447 (normal would be 5432)

The RDD contrib does not have the option to change the port to 5447, it seems that there're fixed somewhere for 5432.

If anyone knows anything please tell me where to change this port.

Thanks

Phil Krylov

unread,
May 20, 2013, 6:23:28 PM5/20/13
to harbou...@googlegroups.com, vl...@altersoft.net
Hi.

On Mon, May 20, 2013 at 5:55 PM, Vlad <vl...@altersoft.net> wrote:
> The RDD contrib does not have the option to change the port to 5447, it
> seems that there're fixed somewhere for 5432.

I suppose you mean Mindaugas's rddsql and sddpg. In this case, from
looking at the code and PostgreSQL API documentation it seems you may
pass a connection string in the connection call, something like:

db := RddInfo(RDDI_CONNECT, "POSTGRESQL", "hostaddr = '127.0.0.1' port
= '5447' dbname = 'fwaggle' user = 'fwaggle' password = 'password'
connect_timeout = '10'")

[have not tested myself]

More info on connection strings can be found here:

http://www.postgresql.org/docs/8.3/static/libpq-connect.html

-- Ph.

Phil Krylov

unread,
May 20, 2013, 6:29:40 PM5/20/13
to harbou...@googlegroups.com, vl...@altersoft.net
On Tue, May 21, 2013 at 2:23 AM, Phil Krylov <ph...@newstar.rinet.ru> wrote:
> More info on connection strings can be found here:
>
> http://www.postgresql.org/docs/8.3/static/libpq-connect.html

P.S. A fresher link:

http://www.postgresql.org/docs/9.2/static/libpq-connect.html#LIBPQ-CONNSTRING

-- Ph.

Vlad

unread,
May 21, 2013, 11:00:05 AM5/21/13
to harbou...@googlegroups.com, vl...@altersoft.net, ph...@newstar.rinet.ru
Thanks for the reply, but it did not work.

The RDDIFO not accept strings, arrays only.

The model below will generate a runtime error as it only accepts two parameters. I tried some variations (no quotes, no spaces) without success.

RddInfo (RDDI_CONNECT, "POSTGRESQL", "hostaddr = '127 .0.0.1 'port
= '5447 'Dbname =' fwaggle 'user =' fwaggle 'password =' password '
connect_timeout = '10 '")

Bacco

unread,
May 21, 2013, 11:20:27 AM5/21/13
to harbou...@googlegroups.com
By the way, probably there is 2 undesired spaces in '127 .0.0.1 '.
> --
> You received this message because you are subscribed to the Google Groups
> "Harbour Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to harbour-deve...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Phil Krylov

unread,
May 21, 2013, 4:00:56 PM5/21/13
to harbou...@googlegroups.com
Hello,

> On Tue, May 21, 2013 at 12:00 PM, Vlad <vl...@altersoft.net> wrote:
>> Thanks for the reply, but it did not work.
>>
>> The RDDIFO not accept strings, arrays only.
>>
>> The model below will generate a runtime error as it only accepts two
>> parameters. I tried some variations (no quotes, no spaces) without success.
>>
>> RddInfo (RDDI_CONNECT, "POSTGRESQL", "hostaddr = '127 .0.0.1 'port
>> = '5447 'Dbname =' fwaggle 'user =' fwaggle 'password =' password '
>> connect_timeout = '10 '")

Ok, my fault, then it should be smth. like:

db := RddInfo(RDDI_CONNECT, { "POSTGRESQL", "hostaddr = '127.0.0.1' " +;
"port = '5447' dbname = 'fwaggle' user = 'fwaggle' password = 'password' " +;
"connect_timeout = '10'" })

-- Ph.

Vlad

unread,
May 21, 2013, 10:21:25 PM5/21/13
to harbou...@googlegroups.com, ph...@newstar.rinet.ru
Phil, Thanks for the tips.

I'll post my findings:

I tested the two methods with the same connection string.

The PQconnectdb works. (without RDD)

But the function of the RDD does not work with connection strings.

I looked at the source code: core.c (folder sddpg)
There is:


static HB_ERRCODE pgsqlConnect( SQLDDCONNECTION * pConnection, PHB_ITEM pItem )
{
   PGconn *       pConn;
   ConnStatusType status;

   pConn = PQsetdbLogin( hb_arrayGetCPtr( pItem, 2 ), NULL, NULL, NULL, hb_arrayGetCPtr( pItem, 5 ), hb_arrayGetCPtr( pItem, 3 ), hb_arrayGetCPtr( pItem, 4 ) );



Note that the second parameter is NULL.

My conclusions:

(1) I think the RDD does not allow changing the default port.
(2) The RDD does not accept connection string
(3) The values ​​should be passed by Array.


I will return for 5432.

Thank you all!

PS: Excuse for my poor english.

Phil Krylov

unread,
May 24, 2013, 7:35:38 AM5/24/13
to Vlad, harbou...@googlegroups.com
On Wed, May 22, 2013 at 6:21 AM, Vlad <vl...@altersoft.net> wrote:
> Phil, Thanks for the tips.
>
> I'll post my findings:
>
> I tested the two methods with the same connection string.
>
> The PQconnectdb works. (without RDD)
>
> But the function of the RDD does not work with connection strings.
>
> I looked at the source code: core.c (folder sddpg)
> There is:
>
>
> static HB_ERRCODE pgsqlConnect( SQLDDCONNECTION * pConnection, PHB_ITEM
> pItem )
> {
> PGconn * pConn;
> ConnStatusType status;
>
> pConn = PQsetdbLogin( hb_arrayGetCPtr( pItem, 2 ), NULL, NULL, NULL,
> hb_arrayGetCPtr( pItem, 5 ), hb_arrayGetCPtr( pItem, 3 ), hb_arrayGetCPtr(
> pItem, 4 ) );
>
>
>
> Note that the second parameter is NULL.

According to PQsetdbLogin() documentation, it accepts a connection
string in the first parameter, then the second parameter is optional.

However, I did not yet test it, I'll do it when I have some time.

-- Ph.
Reply all
Reply to author
Forward
0 new messages