2012年3月27日星期二
bcp Utility login failure
C:\>bcp bookshop..bookcondition in bookcondition.txt -c -T -Ujack -Ppasswor
SQLState = 28000, NativeError = 1845
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'J
CK_WACHTLER\Jack Wachtler'
Thanks for your help
JackJack,
you'll need to remove the -T argument which selects trusted security and
therefore ignores the last 2 arguments. Have a look in BOL : bcp utility,
overview for a listing of all the individual arguments.
HTH,
Paul Ibison|||Using the trusted connection it should assume I am already logged in as a authenticated user. So why am I getting this error? I don't get it
C:\>bcp BookShopDB..BookCondition in BookCondition.txt -c -
SQLState = 28000, NativeError = 1845
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'J
CK_WACHTLER\Jack Wachtler'
Jack|||Jack,
this will create a separate connection to sql server and will only work if
'JACK_WACHTLER\Jack Wachtler' exist as a windows login on the default
instance of sql server on the local computer where you are running bcp, or
alternatively if this windows user exists in a group added as a windows
login.
HTH,
Paul Ibison|||Hi Jack,
Dont you require the -S <Server_name> along with your bcp command? Try to
include this option and verify.
THanks
Hari
MCDBA
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OL6HON4OEHA.2356@.TK2MSFTNGP10.phx.gbl...
> Jack,
> this will create a separate connection to sql server and will only work if
> 'JACK_WACHTLER\Jack Wachtler' exist as a windows login on the default
> instance of sql server on the local computer where you are running bcp, or
> alternatively if this windows user exists in a group added as a windows
> login.
> HTH,
> Paul Ibison
>sql
bcp Utility login failure
C:\>bcp bookshop..bookcondition in bookcondition.txt -c -T -Ujack -Ppassword
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login fai
led for user 'JA
CK_WACHTLER\Jack Wachtler'.
Thanks for your help!
JackJack,
you'll need to remove the -T argument which selects trusted security and
therefore ignores the last 2 arguments. Have a look in BOL : bcp utility,
overview for a listing of all the individual arguments.
HTH,
Paul Ibison|||Using the trusted connection it should assume I am already logged in as a au
thenticated user. So why am I getting this error? I don't get it.
C:\>bcp BookShopDB..BookCondition in BookCondition.txt -c -T
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login fai
led for user 'JA
CK_WACHTLER\Jack Wachtler'.
Jack|||Jack,
this will create a separate connection to sql server and will only work if
'JACK_WACHTLER\Jack Wachtler' exist as a windows login on the default
instance of sql server on the local computer where you are running bcp, or
alternatively if this windows user exists in a group added as a windows
login.
HTH,
Paul Ibison|||Hi Jack,
Dont you require the -S <Server_name> along with your bcp command? Try to
include this option and verify.
THanks
Hari
MCDBA
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OL6HON4OEHA.2356@.TK2MSFTNGP10.phx.gbl...
> Jack,
> this will create a separate connection to sql server and will only work if
> 'JACK_WACHTLER\Jack Wachtler' exist as a windows login on the default
> instance of sql server on the local computer where you are running bcp, or
> alternatively if this windows user exists in a group added as a windows
> login.
> HTH,
> Paul Ibison
>
bcp Utility login failure
C:\>bcp bookshop..bookcondition in bookcondition.txt -c -T -Ujack -Ppassword
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'JA
CK_WACHTLER\Jack Wachtler'.
Thanks for your help!
Jack
Jack,
you'll need to remove the -T argument which selects trusted security and
therefore ignores the last 2 arguments. Have a look in BOL : bcp utility,
overview for a listing of all the individual arguments.
HTH,
Paul Ibison
|||Using the trusted connection it should assume I am already logged in as a authenticated user. So why am I getting this error? I don't get it.
C:\>bcp BookShopDB..BookCondition in BookCondition.txt -c -T
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'JA
CK_WACHTLER\Jack Wachtler'.
Jack
|||Jack,
this will create a separate connection to sql server and will only work if
'JACK_WACHTLER\Jack Wachtler' exist as a windows login on the default
instance of sql server on the local computer where you are running bcp, or
alternatively if this windows user exists in a group added as a windows
login.
HTH,
Paul Ibison
|||Hi Jack,
Dont you require the -S <Server_name> along with your bcp command? Try to
include this option and verify.
THanks
Hari
MCDBA
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OL6HON4OEHA.2356@.TK2MSFTNGP10.phx.gbl...
> Jack,
> this will create a separate connection to sql server and will only work if
> 'JACK_WACHTLER\Jack Wachtler' exist as a windows login on the default
> instance of sql server on the local computer where you are running bcp, or
> alternatively if this windows user exists in a group added as a windows
> login.
> HTH,
> Paul Ibison
>
2012年3月19日星期一
bcp only runs on master database
I can't get bcp to run on any database but 'master'. I get a 'failed to login' error. i'm logged in as 'sa' with full permissions.
Please help
ThanksOriginally posted by markfraser
Hello,
I can't get bcp to run on any database but 'master'. I get a 'failed to login' error. i'm logged in as 'sa' with full permissions.
Please help
Thanks
Here is an example how to do it with VB (youll find this example at the help of MS SQL Server and will help you to do it from within Query analizer too I guess.
Peter
The following Microsoft Visual Basic code uses the BulkInsertTask object to insert data from file D:\DTS_UE\BCPData\Payroll.txt into table Payroll of database DTS_UE.
Public Sub Main()
'initialize Payroll table in DTS_UE db with bulk data
Dim objPackage As DTS.Package2
Dim objConnect As DTS.Connection2
Dim objStep As DTS.Step
Dim objTask As DTS.Task
Dim objBulkCopy As DTS.BulkInsertTask
Set objPackage = New DTS.Package
'create database connection
Set objConnect = objPackage.Connections.New("SQLOLEDB.1")
With objConnect
.ID = 1
.DataSource = "(local)"
.UseTrustedConnection = True
End With
objPackage.Connections.Add objConnect
'create step and task, specify data file and format
Set objStep = objPackage.Steps.New
Set objTask = objPackage.Tasks.New("DTSBulkInsertTask")
Set objBulkCopy = objTask.CustomTask
With objBulkCopy
.Name = "BulkInsTask"
.DataFile = "D:\DTS_UE\BCPData\Payroll.txt"
.ConnectionID = 1
.DestinationTableName = "DTS_UE..Payroll"
.FieldTerminator = "|"
.RowTerminator = "\r\n"
End With
'link step to task to package, run package
objStep.TaskName = objBulkCopy.Name
objStep.Name = "BulkInsStep"
With objPackage
.Steps.Add objStep
.Tasks.Add objTask
.FailOnError = True
.Execute
End With
End Sub|||Originally posted by markfraser
Hello,
I can't get bcp to run on any database but 'master'. I get a 'failed to login' error. i'm logged in as 'sa' with full permissions.
Please help
Thanks
do you have an admin on your team other than yourself? post your bcp.|||True, post the code used and BCP is a command link utility and not pertained to default to any database.
2012年2月25日星期六
BCP Command - Login fails
Dear all,
I have a curious problem using BCP to import and export data. First of all I export data as XML file with the command:
bcp "SELECT * FROM [006]..hopibon FOR XML EXPLICIT" queryout c:\ortec\misc\data.xml -c -r "" -SMMOSSURPBM09 –T
Now this works fine. The table data is exported as data.xml. I use the exported data in an external tool and then the result of that is a csv file. This file needs to be imported again in the SQL database, so I can run some queries. I use the following commandline;
bcp "[606]..ORTECPlanning" IN c:\ortec\misc\planning.csv -c -F1 -t; -SMMOSSURPBM09 –T
When I use this command I get the following error;
SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login ‘[606]’. Login fails.
I tested the following:
1) Run the same command on local PC (SQL Installed) and then no problem at all. So the command seems to be correct.
2) Then I tried to use the –U –P parameters instead of –T. Then the error message changes and states login failed…
3) Changed the command to bcp "[606]..ORTECPlanning" IN "c:\ortec\misc\planning.csv" -c -F1 -t; -S"MMOSSURPBM09" –T
4) Changed the command to bcp [MMOSSURPBM09].[606]..ORTECPlanning IN c:\ortec\misc\planning.csv -c -F1 -t; -SMMOSSURPBM09 –T
5) Remove –t; (suggestion) but this is causing the same error on the server and causing a new error unexpected EOF on the local machine
But no luck… I’m using the administrator to login and perform the command. Exactly the same user and situation as in the queryout command…. So then the question is what is wrong with the command;
bcp [606]..ORTECPlanning IN c:\ortec\misc\planning.csv -c -F1 -t; -SMMOSSURPBM09 –T
bcp "SELECT * FROM [006]..hopibon FOR XML EXPLICIT" queryout c:\ortec\misc\data.xml -c -r "" -SMMOSSURPBM09 –T
Now this works fine
I notice that the commands that fail seem to be hitting a different server ([606]) -NOT [006].
bcp "[606]..ORTECPlanning" IN c:\ortec\misc\planning.csv -c -F1 -t; -SMMOSSURPBM09 –T
When I use this command I get the following error;
SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login ‘[606]’. Login fails.
Did I mis-read that?
BCP Cannot open database requested in login
The problem is that all of them contain a decimal in the DB name.
When BCP runs it gets confused and tries to log on to just the first portion
of the database
For example with a DB named test.server I get the following error
SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database
requested in login 'test'. Login fails.
Is this just a limitation of BCP or is there some sort of work around?
Scott,
Quote it.
c:\>bcp "[my_db_with_._etc].dbo.t1" out "c:\temp\test.txt" ...
AMB
"Scott B" wrote:
> I have several DB's that I am trying to bulk load with data using BCP
> The problem is that all of them contain a decimal in the DB name.
> When BCP runs it gets confused and tries to log on to just the first portion
> of the database
> For example with a DB named test.server I get the following error
> SQLState = 37000, NativeError = 4060
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database
> requested in login 'test'. Login fails.
> Is this just a limitation of BCP or is there some sort of work around?
>
>
BCP Cannot open database requested in login
The problem is that all of them contain a decimal in the DB name.
When BCP runs it gets confused and tries to log on to just the first portion
of the database
For example with a DB named test.server I get the following error
SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot op
en database
requested in login 'test'. Login fails.
Is this just a limitation of BCP or is there some sort of work around?Scott,
Quote it.
c:\>bcp "[my_db_with_._etc].dbo.t1" out "c:\temp\test.txt" ...
AMB
"Scott B" wrote:
> I have several DB's that I am trying to bulk load with data using BCP
> The problem is that all of them contain a decimal in the DB name.
> When BCP runs it gets confused and tries to log on to just the first porti
on
> of the database
> For example with a DB named test.server I get the following error
> SQLState = 37000, NativeError = 4060
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot
open database
> requested in login 'test'. Login fails.
> Is this just a limitation of BCP or is there some sort of work around?
>
>
BCP Cannot open database requested in login
The problem is that all of them contain a decimal in the DB name.
When BCP runs it gets confused and tries to log on to just the first portion
of the database
For example with a DB named test.server I get the following error
SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database
requested in login 'test'. Login fails.
Is this just a limitation of BCP or is there some sort of work around?Scott,
Quote it.
c:\>bcp "[my_db_with_._etc].dbo.t1" out "c:\temp\test.txt" ...
AMB
"Scott B" wrote:
> I have several DB's that I am trying to bulk load with data using BCP
> The problem is that all of them contain a decimal in the DB name.
> When BCP runs it gets confused and tries to log on to just the first portion
> of the database
> For example with a DB named test.server I get the following error
> SQLState = 37000, NativeError = 4060
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database
> requested in login 'test'. Login fails.
> Is this just a limitation of BCP or is there some sort of work around?
>
>