显示标签为“failed”的博文。显示所有博文
显示标签为“failed”的博文。显示所有博文

2012年3月29日星期四

bcp_exec() Failed

Has anyone had the above error ?

We ahve an app that uses a C++ to bulk insert into a database, and
during the procedure it some times gives us a error "bcp_exec()
Failed"

Any ideas.

Cheers.john (johnboy1973@.hotmail.com) writes:
> Has anyone had the above error ?

Many times!

> We ahve an app that uses a C++ to bulk insert into a database, and
> during the procedure it some times gives us a error "bcp_exec()
> Failed"

But I cannot recall that the error comes alone, but is always preceded
by other error messages which tells you what the problems with the
bulk copy is. The message "bcp_exec() failed" can be about anything.

If you have more error messagee, please share them too. If you don't,
maybe you should review the error handling in your C++ program, so that
it is not swallowing all error messagee but the last one.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Cheers. The c++ app is not handling the error at all well, but
compains occasionally in the event logs of invalid xml.

Cheers|||john (johnboy1973@.hotmail.com) writes:
> Cheers. The c++ app is not handling the error at all well, but
> compains occasionally in the event logs of invalid xml.

Looks like you need to improve the error handling then.

Which client library are you using? Coming from the DB-Library corner,
I assumed that you were using that. But there might be a bcp_exec() in
other libraries too. And DB-Library does not understand XML. Then again
I can't see where XML comes into the picture with any bulk-load operation.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Its a pain, basically, the app is VB6 connects to com services which
are written in C++, accessed via iis6 .asp page. So it gets the data
it requires from a sql database via a com+ / C++ Dll. Then trys to
pass the result set through bcp.

So im assuming its not the bcp that is at fault but the app pasing the
data too it. So off we go again in a circle.

Thanks for youre input though.

John|||john (johnboy1973@.hotmail.com) writes:
> Its a pain, basically, the app is VB6 connects to com services which
> are written in C++, accessed via iis6 .asp page. So it gets the data
> it requires from a sql database via a com+ / C++ Dll. Then trys to
> pass the result set through bcp.
> So im assuming its not the bcp that is at fault but the app pasing the
> data too it. So off we go again in a circle.

Maybe. But permit me to make the comment that a major reason that I am
not able to give better advice is that I know precious little of your
application. From wnat you describe above, it seems quite complex, and
maybe it's too complex to cover in a newsgroup posting.

But the general rule is: the more precise information you provide, the
more likely it will be that you get a useful answer.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

2012年3月19日星期一

bcp only runs on master database

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
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年3月8日星期四

bcp failed when special characters {;" were used in the password from command line in Win 2

bcp worked with password in normal characters, but failed with {;"

I tried for SQL 2005 and SQL 2000, from Window 2003 SP1. Is this a bug?

When the special character { was used in the password, bcp failed with Native error 0.

>>

F:\ftp\log\Cases>bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P{
SQLState = 08001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Neither DSN nor SERVER keyword supplied
SQLState = 01S00, NativeError = 0
Warning = [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute
>>

When the special character ; or " was used in the password, bcp failed with Native error 18456.

>>

F:\ftp\log\Cases>bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P;
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sem5'.

F:\ftp\log\Cases>bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P"
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sem5'.
>>

Could you try :

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P"{"|||

I tried the followings but it didn't work.

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P"{"

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P'{'

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P\{


|||Please try {{} for pwd {|||

I opened a case and got an answer.

Based on the Microsoft SQL Server 2005 online help for “Strong Passwords[SQL Server]”,

>>

if used in an OLE DB or ODBC connection string, a login or password must not contain the following characters: [] {}() , ; ? * ! @.. These characters are used to either initialize the connection or separate connection values.

>>

As the result, SQL Server Enterprise Manager allows all special characters but the OLE DB or ODBC connection is different.

|||

Thanks for following up your own post. It helps others when you share your solution.

2012年2月16日星期四

bckhist.cpp - Failed Assertion = 'm_markCVount < m_maxLogMarks'

The SQL Server (Product Version 8.00..., SQL Server 2000) writes the follow
ing errors:
- SQL Server Assertion: File: >bckhist.cpp>, line=1742, Failed Assertion = '
m_MarkCount < m_maxLogMarks'
- Error: 3624, Severity: 20, State:1
- Error: 3449, Severity: 21, State:1, An error has occured that reequires SQ
LServer to shutdown so that recovery can be performed on database ID...
After these errors -> the SQLServer shutdown...
Please Help, thanks!This maybe an issue with the use of begin transaction with Mark Argument
that updates a table with trigger with insert.
Remove the with Mark argument from the being transaction to avoid the
issue.
If you need further information, I would suggest you open a call with
Microsoft support that will be able to assist you further with this issue.
Regards
Agnes Panosian
SQL Server Support