Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2007
    Posts
    27

    Question Unanswered: sqlcmd fine, but bcp can't connect

    I'm a bcp newbie (i.e. I've never actually used it before) and I'm having some trouble. I'm trying to use it from the command line so that I can understand it enough to create batch files later. I'm able to use sqlcmd just fine, but using the same info to try and use bcp doesn't seem to work.

    The command that I'm using for sqlcmd is as follows:
    Code:
    sqlcmd -S MySqlServer -U MyUsername -P MyPassord
    (Of course those aren't the actual values I'm using, but you get the idea). This connects fine, and to test it I've selected a few rows from a few different tables. Everything works fine. I then quit and try to use bcp with something like the following:
    Code:
    bcp MyDatabase.dbo.MyTable out MyOutput.txt -S MySqlServer -U MyUsername -P MyPassword
    (just to verify, I'm trying to output the table to the file, so I use "out" right?) This gives the following error:
    Code:
    CTLIB Message: - L6/08/S5/N3/5/0:
    ct_connect(): directory service layer: internal directory control layer error: Requested server name not found. 
    Establishing connection failed.
    Presumably if sqlcmd is able to connect, then the server MySqlServer is a valid server name and so bcp should be able to connect as well, right? Or is there additional information that bcp needs to have?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You are running on a machine with both Microsoft and Sybase client tools installed on it, this is a disaster in search of its next victim. Without knowing EXACTLY how you want the machine configured I can't guess at how to configure it.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Dec 2007
    Posts
    27
    Oh well, part of the reason this has come up is because we're getting rid of Sql Server altogether in the near future, so it won't be an issue in a few months. I was hoping for an easy way to export the data so it can be loaded into an Oracle database later. The migration tools in the SQL Developer software has been quite a disappointment, so I was going to hack together a migration system that I can use this once and then just scrap.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    SQL Server could use SSIS or a linked server to push the data to Oracle.

    If you explicitly specify the path so that Windows can tell which of the BCP.EXE programs you want it to use (instead of the first one it finds in the path), then you could use the Microsoft BCP.EXE instead of the Sybase BCP.EXE and you'd be fine.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •