python - SQL server bulkinsert errors -


when run query bulkinsert file on shared drive sql server 2008 username , password (not windows authentication), these errors. dba, system admins , network guys denying these errors related teams , lost... can please me identify issue is? when run bulkinsert database username , password, authentication sql server use open file?

run on ms management studio

bulk insert databasename.dbo.tablename '\\shared_server\parent\child\file_name.txt'  with(fire_triggers, datafiletype='char', fieldterminator='\t',rowterminator='\n', firstrow=2); 

and get

cannot bulk load because file  "\\shared_server\parent\child\file_name.txt" not opened. operating system error code 5(access denied.). 

run on python

import pyodbc  database = 'databasename' username = 'username' password = 'password' server = 'server_name' failover = 'failover_server_name' cnxn_string = 'driver={sql server native client 10.0};server=%s;failover_partner=%s;database=%s;uid=%s;pwd=%s;charset=utf8' % (server, failover, database, username, password) cnxn = pyodbc.connect(cnxn_string) cursor = cnxn.cursor()  query = r""" bulk insert estimates.dbo.fundamentalsis  '\\shared_server\parent\child\file_name.txt'  with(fire_triggers, datafiletype='char', fieldterminator='\t',rowterminator='\n', firstrow=2); """ cursor.execute(query) cursor.commit()" 

and get

programmingerror: ('42000', '[42000] [microsoft][sql server native client 10.0][sql server]cannot bulk load because file "\\shared_server\parent\child\file_name.txt" not opened. operating system error code 1326(logon failure: unknown user name or bad password.). (4861) (sqlexecdirectw)') 

could ms sql server 2008 possibly on different security group (or have different settings) shared drives, file located?

because bulk insert operation run on ms management studio server side, might not have access file, 'access denied' leads me believe db server cannot shared file drive, , possibly not have permission access it. likewise, if using python execute bulk insert statement, db server still needs have access ever file located.

i had similar issue in past, because db server not shared file, located elsewhere. workaround use local computer read in file , run insert queries using python. sounds local environment has access both , can used central communication hub. might have similar to


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -