If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > sqlcmd fine, but bcp can't connect

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-02-10, 08:15
VentureFree VentureFree is offline
Registered User
 
Join Date: Dec 2007
Posts: 27
Question 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?
Reply With Quote
  #2 (permalink)  
Old 09-02-10, 12:08
Pat Phelan Pat Phelan is online now
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,602
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.
Reply With Quote
  #3 (permalink)  
Old 09-02-10, 13:23
VentureFree VentureFree is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 09-02-10, 15:18
Pat Phelan Pat Phelan is online now
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,602
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On