ADO is a connected data access, which means that when a connection to the database is established the connection remains open till the application is closed.
In ADO, all the data is contained in a recordset object which had problems when implemented on the network and penetrating firewalls.
# OS authentication connection files do not have a 'user' property. Describe(workspace).connection # Get a list of all the datasets the user has access to. List Feature Classes('*.' + user Name + '.*') + arcpy.
# First, get all the stand alone tables, feature classes and rasters. List Rasters('*.' + user Name + '.*') # Next, for feature datasets get all of the featureclasses # from the list and add them to the master list. List Datasets('*.' + user Name + '.*'): data List += arcpy.
List Feature Classes(feature_dataset=dataset) # pass in the list of datasets owned by the admin to the rebuild indexes and analyze datasets tools # Note: to use the "SYSTEM" option the user must be an administrator. Rebuild Indexes_management(workspace, "SYSTEM", data List, "ALL") arcpy.
Data access is making the application interact with a database, where all the data is stored. To overcome with some of the problems mentioned above, ADO . Likewise, if a database is Updated, the connection is opened long enough to complete the Update operation and is closed.
Many applications need data access at one point of time making it a crucial component when working with applications. Also, open database connections use system resources to a maximum extent making the system performance less effective. NET addresses the above mentioned problems by maintaining a disconnected database access model which means, when an application interacts with the database, the connection is opened to serve the request of the application and is closed as soon as the request is completed.
Different applications have different requirements for database access. By keeping connections open for only a minimum period of time, ADO . Keeping the connection open for the lifetime of the application raises concerns about database security and network traffic.I want to script out the compressing, rebuilding of indexes and updating statistics on our SDE databases, but I want to make sure I have the correct order for these to run. SERVER = "mailserver.yourcompany.com" FROM = "SDE Admin " TO = email List SUBJECT = "Maintenance is about to be performed" MSG = "Auto generated Message.\n\r Server maintenance will be performed in 15 minutes. For the order, I would assume: import arcpy, time, smtplib # set the workspace workspace = 'Database Connections/admin.sde' # set a variable for the workspace workspace = workspace # get a list of connected users. List Users("Database Connections/admin.sde") # get a list of usernames of users currently connected and make email addresses email List = [u. List Users("Database Connections/admin.sde")] # take the email list and use it to send an email to connected users.Please log off." # Prepare actual message MESSAGE = """\ From: %s To: %s Subject: %s %s """ % (FROM, ", ".join(TO), SUBJECT, MSG) # Send the mail server = smtplib.SMTP(SERVER) server.sendmail(FROM, TO, MESSAGE) server.quit() #block new connections to the database. Accept Connections('Database Connections/admin.sde', False) # wait 15 minutes time.sleep(900) #disconnect all users from the database. Disconnect User('Database Connections/admin.sde', "ALL") # Get a list of versions to pass into the Reconcile Versions tool. List Versions('Database Connections/admin.sde') # Execute the Reconcile Versions tool. Reconcile Versions_management('Database Connections/admin.sde', "ALL_VERSIONS", "sde. DEFAULT", version List, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_TARGET_VERSION", "POST", "DELETE_VERSION", "c:/temp/reconcilelog.txt") # Run the compress tool. Compress_management('Database Connections/admin.sde') #Allow the database to begin accepting connections again arcpy.