I'm in the process of migrating our file geodatabase processing tasks (which utilise ArcPy) from Windows to Linux. The initial challenge is to successfully get ArcPy connecting to the IBM Informix (version 12.10.FC5W1) databases via the ODBC direct connections.
I have configured the ODBC driver (odbcinst.ini), data sources (odbc.ini), and environment variables ($INFORMIXDIR, $INFORMIXSQLHOSTS, $ODBCSYSINI, $ODBCINI, $ODBCINSTINI, $LD_LIBRARY_PATH, and $PATH). This allows successful direct connection via the isql utility sourced from the unixODBC package:
isql -v DBP user password
The virtual environment for Python/ArcPy was configured via Conda as follows:
conda create --name arcgis-10.6.1 python=3.6.6
conda activate arcgis-10.6.1
conda install -c esri arcgis-server-10.6.1-py3
Checking the installation details via the Python interpreter (within the arcgis-10.6.1 virtual environment) returns the following:
>> Returns: "ArcServer"
>> Returns: "10.6.1"
So, the ODBC driver and data sources, as well as ArcPy, appear to be working just fine.
As far as I'm aware (please correct me if I'm mistaken), even though connections via ArcSDE have been deprecated, SDE connection files (.sde) are still required to allow ArcPy to connect and interact with databases. Due to this, I attempted to create a SDE connection file (.sde) via the Python interpreter (within the arcgis-10.6.1 virtual environment) as follows:
out_path = "/home/developer/connections"
>> Returns: True
folder = arcpy.Describe(out_path)
>> Returns: "Folder"
arcpy.CreateDatabaseConnection_management(folder, "DBP.sde", "INFORMIX", "DBP", "DATABASE_AUTH", "user", "password", "SAVE_USERNAME")
>> Throws "RuntimeError" Exception: "Object: Error in executing tool."
Unfortunately, this is unsuccessful and throws an exception (which doesn't provide any meaningful insight into the cause). The permissions for the output path are appropriate, and the Python interpreter is able to read and write files under normal circumstances.
I also tried switching the first argument from a Folder instance to a String instance containing the desired output path:
arcpy.CreateDatabaseConnection_management(out_path, "DBP.sde", "INFORMIX", "DBP", "DATABASE_AUTH", "user", "password", "SAVE_USERNAME")
>> Throws "ExecuteError" Exception: "Failed to execute. Parameters are not valid."
Whilst unsuccessful, the thrown exception gives some insight into what the cause may be.
>> Error 000800: The value is not a member of SQL Server, Oracle, DB2, PostgreSQL, Netezza, Teradata, SAP HANA, ALTIBASE, or Dameng.
>> Warning 000565: Could not connect to server.
Curiously, this seems to be referring to the "database_platform" parameter, which doesn't appear to include "INFORMIX" as a valid option. According to the documentation for ArcGIS 10.6 (here, here, and here), IBM Informix should be supported. However, looking at the documentation for ArcGIS Pro (here), IBM Informix isn't supported.
Does this mean that ArcPy is using the ArcGIS Pro API (and not the ArcGIS 10.6 API), and therefore, IBM Informix isn't supported (and in order to continue using it we'd have to persevere with Windows)?
Finally, I created a SDE connection file (.sde) via ArcCatalog (ArcGIS Desktop Advanced 10.3.1) on Windows for use on Linux, but the following was also unsuccessful:
>> Returns: "/home/developer"
arcpy.env.workspace = os.path.join(os.getcwd(), "connections", "DBP.sde")
>> Returns: "/home/developer/connections/DBP.sde"
>> Returns: null
Any clarification would be greatly appreciated, and I apologise if I've overlooked anything obvious. Thanks!