Recent

Author Topic: The SQLdb Port do Connect  (Read 5700 times)

El Muerte

  • Guest
The SQLdb Port do Connect
« on: June 16, 2006, 08:58:14 pm »
Hi all,

I looked up for the properties where I can change the port to connect to the postgre database and i didnt find it!

How may I change the port to connect to postgre using SQLdb package?

thanks

Anonymous

  • Guest
RE: The SQLdb Port do Connect
« Reply #1 on: June 17, 2006, 06:00:30 am »
You know at first I thought how silly.  But then I started looking I don't know where I can change the port address.  On monday I'll ask on the IRC.  Joost might shed some light.
John

johnf

  • New Member
  • *
  • Posts: 18
RE: The SQLdb Port do Connect
« Reply #2 on: June 19, 2006, 06:12:00 pm »
I contacted Joost and he showed me where the port address can be provided.  The params of the connect is where you assign the port.  If you look at pqconnection.pp you will see:

procedure TPQConnection.DoInternalConnect;

var msg : string;

begin
{$IfDef LinkDynamically}
  InitialisePostgres3;
{$EndIf}

  inherited dointernalconnect;

  FConnectString := '';
  if (UserName <> '') then FConnectString := FConnectString + ' user=''' + UserName + '''';
  if (Password <> '') then FConnectString := FConnectString + ' password=''' + Password + '''';
  if (HostName <> '') then FConnectString := FConnectString + ' host=''' + HostName + '''';
  if (DatabaseName <> '') then FConnectString := FConnectString + ' dbname=''' + DatabaseName + '''';
  if (Params.Text <> '') then FConnectString := FConnectString + ' '+Params.Text;

  FSQLDatabaseHandle := PQconnectdb(pchar(FConnectString));

The Params.Text would need to contain something like "port=????"

Hope this helps.

Anonymous

  • Guest
RE: The SQLdb Port do Connect
« Reply #3 on: June 23, 2006, 08:20:10 am »
I tryed this:

  Datamodule1.PQConnection1.Params.Text:='port=8000';

didnt worked....

any more idea?

Anonymous

  • Guest
RE: The SQLdb Port do Connect
« Reply #4 on: June 26, 2006, 05:14:41 pm »
I suggest you submit this question to the mailing list.  
BTW I have not had any success using a datamodule.  You may want to try creating a test form and add a connection for testing.  Also I did not test myself.  I wonder if the 'FconnectString'
requires something different than what I suggested.  You could compile the FPC with debug on and place a break point and see what the actual 'FConnectionString' looks like.  
Maybe it is structured differently than I suggested.

John

Anonymous

  • Guest
RE: The SQLdb Port do Connect
« Reply #5 on: June 27, 2006, 06:11:47 pm »
This problem seems have no solution... Well, what's the list address? I'll look for some help there too

thanks!

el Muerte

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: The SQLdb Port do Connect
« Reply #6 on: June 27, 2006, 07:13:12 pm »
There is a link "Mailing List" on the left part of this website.

 

TinyPortal © 2005-2018