I already posted this question here but got no satisfying answer so far.
My problem ist the following: I connect to an ArcSDE-geodatabase using CreateArcSDEConnectionFile. When I execute this code I get a warning
WARNING 000565: Could not connect to server.
However the file was created, I can even drop it to ArcCatalog-folder, where SDE-files are located and open the connection in ArcCatalog.
However the connection-parameters seem valid as I already checked the same on my own machine - working.
This is the appropriate code so far:
temp = r'C:\Users\admin\AppData\Local\Temp'
host = "myServer"
sdeFileName = "mySdeFile.sde"
service = "sde:oracle11g:myHost/myInstance:" + user
arcpy.CreateArcSDEConnectionFile_management(temp, sdeFileName, myHost, service, username = user, password = password, version = version)
What makes me confuse is that when chaning to application-server-connection the function returns without any error or warning (also checked it with Direct-Connect, which works also).
So I assume that the mentioned warning not necessarily means an invalid connection. Thus I appended a check for the contained datasets:
if "000565" in arcpy.GetMessages() and arcpy.ListDatasets() == []: raise IOError("Invalid SDE-connection paramaters")
However this seems bit overkill to me.
Is this a bug? Am I stuck on making a check on the datasets?
Solved! Go to Solution.
If you are using a Direct Connect, use the Create Database Connection tool.
arcpy.CreateDatabaseConnection_management
If you are using a Direct Connect, use the Create Database Connection tool.
arcpy.CreateDatabaseConnection_management