BCP and PORT

  • Hi all SQL Masters,

    It seems that BCP.EXE utility don't works when the Sql Server use an other Port than

    the default Port (1433).

    I don't see anywhere in BCP.EXE guidelines the topic which talk about the tcp port parameter.

    I've tried -S127.0.0.1,5582 or -S127.0.0.1:5582 but without good result... ;(

    My server runs on port 5582 and I can't launch my batchs. But if I change the port with 1433, it's work correctly...

    Do you have a solution of this problem ?

    Thank a lot

    Bruno

  • Is this a named instance? Or just a non-standard port?

    Have you tried servername\instancename?

    You MIGHT setup an alias in client network config and point localhost as servername and port or servername\instancename and port..

    CEWII

  • Hi,

    I'm just using a non-standard port.

    But I didn't create alias or instance, so I didn't tried "servername\instancename".

    The instance running on Sql server it the default instancename.

    An other point : The BCP execution is not located on SQL server but on Web server.

    I don't know if Web Server can use an "instancename" of an other server that itself.

    Do you have an idea ?

    Thanks a lot

    Bruno

  • How are you using bcp then? How did it get installed on that server?

    Since you would have to have the SQL drivers installed I would use the Client Network Utility to setup an alias. What this does is kind of short cicuit the name and port resolution process. When you say connect to server MyServer1 it goes and sees if there is an alias for MyServer1 at: HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\ConenctTo

    If there is it uses what is there, that location specifies protocol (you should be using TCP/IP), name or ip address, and port. If you specify a name then DNS/hosts file will be used to resolve the name to an ip address. But where we are going with this is that in the future from that machine you only have to use the alias to get there.

    Not pretty but it works..

    CEWII

  • Try adding the port with -S<server_name>,<port> in the BCP command

    E.g. bcp <... commands ...> -Umyuser -Pmypwd -SmyServer,1434

  • You need to add double quotes on the server parameter

    bcp <commands...> -S"servername\instance, port"

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply