由于无法打开文件,因此无法批量加载。操作系统错误代码1326(登录失败:用户名未知或密码错误。) [英] Cannot bulk load because the file could not be opened. Operating system error code 1326(Logon failure: unknown user name or bad password.)

查看:546
本文介绍了由于无法打开文件,因此无法批量加载。操作系统错误代码1326(登录失败:用户名未知或密码错误。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从csv测试文件批量上传

bulk upload from csv test file

\服务器名\wwwroot\Upload\LDSAgentsMap.txt

"\servername\wwwroot\Upload\LDSAgentsMap.txt"

     SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[sp_CSVTest_BulkInsert] ( @Path NVARCHAR(128) )
AS 
    DECLARE @Sql NVARCHAR(256)
    SET @Sql = 'BULK
INSERT CSVTest 
FROM ''' + @Path + ''' WITH
(
FIELDTERMINATOR = '','',
ROWTERMINATOR = ''\n''
)'
--PRINT @Sql
EXEC(@Sql)

GO

路径为 \服务器名\wwwroot\Upload\LDSAgentsMap.txt

path is "\servername\wwwroot\Upload\LDSAgentsMap.txt"

note

这位于共享主机和数据库中用户具有blukadmin和公共服务角色

this is in shared hosting and database user have blukadmin and public service role

推荐答案

当运行SQL的Windows用户帐户(例如SqlServerAccount)不存在时,可能会发生这种情况。没有访问共享文件的权限(\服务器名\wwwroot\Upload\LDSAgentsMap.txt)。

This can occur when the Windows user account that SQL runs under (e.g. SqlServerAccount) doesn't have permissions to access the shared file (\servername\wwwroot\Upload\LDSAgentsMap.txt).

一种方法我们已经完成了将共享文件所在的计算机的工作。在该计算机上,添加一个Windows用户帐户,该用户帐户的用户名和密码与运行SQL的帐户相同。

One way we've worked through this is to go to the machine where shared file resides. On that machine, add a Windows user account with the same user name and password as the account that SQL runs under.

例如,

如果您的数据库位于MyDatabaseServer上,并且使用密码Foo在Windows用户帐户SqlServerAccount下运行,则转到共享文件所在的计算机,例如MyFileServer,并使用密码Foo创建一个名为SqlServerAccount的Windows用户帐户。

If your database resides on MyDatabaseServer, and runs under a Windows user account SqlServerAccount with password Foo, then go to the machine where your shared file resides, e.g. MyFileServer, and create a Windows user account named SqlServerAccount with password Foo.

最后一步:进入MyFileServer上的文件夹共享,然后进入该文件夹的共享属性。 (在Win7上,右键单击文件夹->属性->共享->高级共享)。然后为您创建的SqlServerAccount添加读取权限。

Last step: go into the folder share on MyFileServer and go into sharing properties for that folder. (On Win7, right-click the folder->Properties->Sharing->Advanced Sharing). Then add read permission for SqlServerAccount that you created.

这篇关于由于无法打开文件,因此无法批量加载。操作系统错误代码1326(登录失败:用户名未知或密码错误。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆