I am trying to edit data that is in an ArcSDE Oracle database with updates in a file geodatabase. I want to be able to make these changes on a separate version to isolate them.

If I connect to a version created through ArcMap 10.2.1, I am able to edit and apply changes and they can be seen through the GUI. I want to be able to create a version through the python script and then apply the changes to that version.

However, when the code invokes the edit = arcpy.da.Editor(myconnect) command it returns the error:

edit = arcpy.da.Editor(myconnect)
RuntimeError: The database was not found.

There doesn't seem to be much I can find on the web about this error. The code below is how I create the version but is currently commented out to simplify the debugging process.

Initially I would connect without trying to connect to the version directly and as annoying as it seems, when editing each feature, I would create a layer for that, then change the version for that layer. However, I was unable to get that to work and then thought I could just connect to the version directly. So much for that idea! The objects are ArcFM features, I wouldn't think that has anything to do with it but as I've found out before, I could well be wrong!

Here is the abbreviated code I have:

app = Dispatch('Miner.Framework.Dispatch.MMAppInitializeDispatch') 
au = Dispatch('Miner.Framework.Dispatch.MMAutoupdaterDispatch')
runtime = Dispatch('Miner.Framework.Dispatch.MMRuntimeEnvironmentDispatch')
runtime.RuntimeMode = mmRuntimeMode.mmRuntimeModeArcServer
au.AutoUpdaterMode = mmAutoUpdaterMode.mmAUMNoEvents
    versionName="%s.%s" % (user, versionBase)
##    myconnect = sdeConnection.connect("", "FMSQA", user, password,"")
##    found = False
##    for version in arcpy.da.ListVersions(myconnect):  
##        if versionName in version.name:
##            found = True
##            break
##    if (found == False):
##        arcpy.CreateVersion_management(myconnect, "SDE.DEFAULT", versionBase, "PUBLIC")
    myconnect = sdeConnection.connect("", "FMSQA", user, password, versionBase)
    arcpy.env.workspace = myconnect
    edit = arcpy.da.Editor(myconnect)

My database connection code is basically taken from here https://gis.stackexchange.com/a/17028/14120

  • 2
    What is sdeConnection in myconnect = sdeConnection.connect(? I usually use a pre-rolled SDE connection file - is this the case? The docs say in ArcGis 10.2 (and earlier) use 'Create Database Connection' tool instead then use the database connection file like a folder path like this gis.stackexchange.com/questions/16859/… note you don't have to put the connection in your default location, it works just fine from os.environ.get('TEMP'). Aug 26, 2016 at 5:45
  • Michael, the link you posted is the same question I linked to at the bottom of my post. The sdeConnection creates the connection file if it doesn't exist, using the arcpy.CreateArcSDEConnectionFile_management method.
    – Bryan
    Aug 26, 2016 at 11:58
  • 1
    It's been over 9 years since I had anything to do with ArcFM and Oracle, can you confirm after you've set your workspace that it actually exists and is readable, a list datasets or feature classes should do to establish the existence and readability.. if it isn't accessible at this stage you should get an error or an empty list. You are sure your connected user does have the correct database permissions to edit the data. Aug 28, 2016 at 21:52

1 Answer 1


Thanks for Michael's answer it put me on the right track with debugging from scratch. Not surprisingly, I found several issues.

With the code I wrote based on the sdeConnection https://gis.stackexchange.com/a/17028/14120, I had several issues:

  • It saved the password, but not as part of the file name, so when I supplied a different password the code found a connection file for the database but did not know the password was different.
  • The indentation on part of the code was incorrect, so it wasn't picking up the message that the database connection failed.
  • The code changes the version to upper case, the version I created was lower case.

So, once my internal infrastructure issues was resolved I was able to resolve this. I now create the sde connection filename based on md5 hashing the parameters including password, so if password, version, user, database or service change it creates a new hex hash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.