can't connect sql server if the port is't 1433

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bugmenot1
Posts: 6
Joined: Wed 04 Nov 2009 03:23

can't connect sql server if the port is't 1433

Post by bugmenot1 » Tue 29 Mar 2011 10:57

if the SQL Server's port isn't 1433.

the code didn't connected

Code: Select all

 with UniConnection1 do
    begin
      Connected := False;
       database:=ServerDB;
       Username:=ServerUser;
        port:=ServerPort;
        Password:=ServerPass;
        Server:=ServerIP;
      Connected := True;
    end;
but this code is ok

Code: Select all

 with UniConnection1 do
    begin
      Connected := False;
       database:=ServerDB;
       Username:=ServerUser;
//        port:=ServerPort;
        Password:=ServerPass;
        Server:=ServerIP+','+ServerPort;
      Connected := True;
    end;

AndreyZ

Post by AndreyZ » Tue 29 Mar 2011 14:16

Hello,

It's a correct UniDAC behaviour. It's needed for maintaining compatibility with SDAC that doesn't have the Port property. To use specific port for SQL Server, you should set the TUniConnection.Server property in the following way:

Code: Select all

UniConnection.Server := 'host,port';

Post Reply