Hi all,
I tried enabling a SQL Server (Express Edition: 14.0.3022.28) database as an Enterprise Geodatabase from arcpy in ArcGIS Server (10.6 on Ubuntu 16.04 LTS) on Linux machine, which fails. Here goes the details:
I did the following to first create the Database Connection (.sde) file in ArcGIS Server machine's arcpy:
- Created a database testsde in the SQL Server instane
- Installed MS SQL Server ODBC client (v13.1) on the Linux machine where ArcGIS Server is installed.
- Open Python interactive in ArcGIS Server machine: <Server Installation Directory>/tools/python
- Executed the logic:
<SPAN class="keyword token">import</SPAN> arcpy
arcpy<SPAN class="punctuation token">.</SPAN>CreateDatabaseConnection_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'<ArcGIS Installation Directory>/temp'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'sqlconn.sde'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SQL_SERVER'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'<host_ip>'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'DATABASE_AUTH'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'sa'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'<password>'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SAVE_USERNAME'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'testsde'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># N.B.: I've already copied the ArcGIS Server authorization file to /home/<user>/ directory</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>EnableEnterpriseGeodatabase_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'<ArcGIS Installation Directory>/temp/sqlconn.sde'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'/home/<user>/keycodes'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The code threw the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\ArcGIS\Server\ArcPy\arcpy\management.py", line 5311, in EnableEnterpriseGeodatabase
raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000837: The workspace is not the correct workspace type.
Failed to execute (EnableEnterpriseGeodatabase).<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Now, since the error said The workspace is not the correct workspace type, I checked the properties of the SDE file created using arcpy.Describe():
desc <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Describe<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'<path_to>/sqlconn.sde'</SPAN><SPAN class="punctuation token">)</SPAN>
desc<SPAN class="punctuation token">.</SPAN>workspaceType
desc<SPAN class="punctuation token">.</SPAN>ConnectionProperties<SPAN class="punctuation token">.</SPAN>is_geodatabase<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Python threw the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: DescribeData: Method workspaceType does not exist<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
So, this did not work as well.
Does connecting to a SQL Server database work at all from ArcGIS Server on Linux? Can I enable SQL Server DB as an enterprise Geodatbase from ArcGIS Server on Linux?
Thank You for Your time.
(P.S.: Do let me now if you need further details to understand the questions.)
Regards,
Lakshmi Kanthan M.