ERROR
Using the ArcPy.DisconnectUser function in a python script as a scheduled task to disconnect users from an enterprise database fails and returns the following error message:
Error: RuntimeError:Connection information provided was for a non-administrative user
The error occurs even though the user has certain administrative privileges to access the database or for database authentication, and the connection file has credentials stored.
Possible causes include:
Use an admin user account to disconnect users. If the right privileges are granted and the issue reoccurs, resolve by denying new connections to the database and implementing the time module to ensure active attempts to connect fail. Complete the steps provided to accomplish this.
import arcpy import time
admin_workspace = '[SDECONNECTIONFILE]' arcpy.env.workspace = admin_workspace
arcpy.AcceptConnections(admin_workspace, False)
time.sleep(120)
arcpy.DisconnectUser(admin_workspace, "ALL")
The following shows the full code:
import arcpy import time admin_workspace = 'Database Connections\sample_connection.sde' arcpy.env.workspace = admin_workspace arcpy.AcceptConnections(admin_workspace, False) time.sleep(120) arcpy.DisconnectUser(admin_workspace, "ALL")
Article ID: 000018531
Get help from ArcGIS experts
Download the Esri Support App