3

When I create an SDE-file using arcpy I get the following warning:

WARNING 000565: Could not connect to server.

This is the appropriate code

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)

However the file itself was created successfully and I can even put it into ArcCatalogs sde-connections-folder and open it in ArcCatalog. Thus I doubt the error occurs because of any missing privileges.

As this message is quite generic and can be caused by many different problems I don´t want to swallow it.

Has anyone a solution or at least an explanation for this?

I am using ArcGIS 10.2 and Python 2.7 for 32bit.

EDIT: When I use

arcpy.CreateDatabaseConnection_management(temp, sdeFileName, "ORACLE", service, username = user, password = password, version = version)

instead it works without any problems.
However as I also have some customers that still use Application-Server-connections I cannot use this function as there´s no information on the actual host given within the service-paramater as opposed to the DirectConnect-syntax, where the paramater includes both the host and the database-instance.

So what I need is a function that works with all the following inputs:

  1. Application-Server-connection (deprecated)

    host = "myServer"
    service = "5151:mySdeInstance"

  2. Direct-Connect-connection

    service = "sde:oracle11g:tnsName:user"
    where tnsName corresponds the name for that connection within tnsnames.ora.

  3. Easy-Connect-connection

    service = "sde:oracle11g:myServer/user:user"

  • You haven't provided enough information -- all the parameters are hidden in variables. – Vince Mar 30 '16 at 14:17
  • @Vince I´m not sure if the information I provided within the update will help any further, but here they are. – HimBromBeere Mar 30 '16 at 14:31
  • Are you really using a user-schema geodatabase? (This is not a recommended configuration). Is the "user" variable anything other than "mySchema"? Still unclear: Is the arcpy command running in a 32-bit or 64-bit Python? – Vince Mar 30 '16 at 14:49
  • @Vince In our envireonemtn mySchema is identical to the user of the GDB, I´m not sure on the exact term however. – HimBromBeere Mar 30 '16 at 14:53
  • If you're not using 10.2.2 with the 23 patches applied, then that's your first task. After that, I'm afraid you'll need to talk with Tech Support. – Vince Mar 30 '16 at 15:06
0

Direct connections and 3-tier connections with geoprocessing tools must be created with separate tools. To supply a port or service name, try using the Create ArcSDE Connection File tool.

http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/create-arcsde-connection-file.htm

arcpy.CreateArcSDEConnectionFile_management(r'c:\connectionFiles',
                                        'gpserver',
                                        '5151',
                                        '',
                                        'toolbox',
                                        'toolbox',
                                        'SAVE_USERNAME',
                                        'SDE.DEFAULT',
                                        'SAVE_VERSION')

For a direct connection, use CreateDatabaseConnection_management as suggested above.

  • Have you even read my question? I need an appraoch that not only works for application-server-connections. Furtheremore you do not provide an Sde-filename but only a path-name and your parameters seems quite confusing to me. What is toolbox? If it is the username and password you´re also missing the account_authentication-param. – HimBromBeere Apr 1 '16 at 8:40
  • I realized that the method you mention may work for Direct/Eazy Connect also, but was actually designed for Application Server-connections only. Maybe you could add that for all other types we need CreateDatabaseConnection instead into your answer. – HimBromBeere Apr 4 '16 at 10:18
  • Gotcha. I could have added this as a reply instead of an answer but I come across this question frequently. We're now 3 versions of ArcGIS since the ArcSDE component has been retired and documentation is getting harder and harder to find. – Ken Apr 19 '16 at 19:03

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.