Select to view content in your preferred language

Enabling a SQL Server Database as Enterprise Geodatabase from arcpy in ArcGIS Server 10.6

2087
3
03-19-2018 07:27 AM
Lakshmi_KanthanMuralikrishnan
Occasional Contributor

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:
import arcpy

arcpy.CreateDatabaseConnection_management('<ArcGIS Installation Directory>/temp', 'sqlconn.sde', 'SQL_SERVER', '<host_ip>', 'DATABASE_AUTH', 'sa', '<password>', 'SAVE_USERNAME', 'testsde')

# N.B.: I've already copied the ArcGIS Server authorization file to /home/<user>/ directory

arcpy.EnableEnterpriseGeodatabase_management('<ArcGIS Installation Directory>/temp/sqlconn.sde', '/home/<user>/keycodes')

‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

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).‍‍‍‍‍‍‍‍‍‍‍‍‍‍

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 = arcpy.Describe('<path_to>/sqlconn.sde')

desc.workspaceType

desc.ConnectionProperties.is_geodatabase‍‍‍‍‍‍‍‍‍‍

Python threw the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: DescribeData: Method workspaceType does not exist‍‍‍‍‍‍

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.

0 Kudos
3 Replies
TinaMorgan1
Frequent Contributor

I was not aware that the Enable Enterprise Geodatabase tool could (should) be used on SQL Server express instances, which can only house Workgroup and Desktop geodatabases (not enterprise).

Just open ArcCatalog, connect to your SQL Server Express instance and create a new geodatabase.

Lakshmi_KanthanMuralikrishnan
Occasional Contributor

Hi Tina,

Thanks for your reply!

I was not aware that the Enable Enterprise Geodatabase tool could (should) be used on SQL Server express instances, which can only house Workgroup and Desktop geodatabases (not enterprise).


I did try enabling a SQL Server Express instance DB as an Enterprise Geodatabase from a Windows Server installation of ArcGIS Server (10.5.1). It worked without any hassle.

Also, the documentation says it is supported: Microsoft SQL Server database requirements for ArcGIS 10.6—System Requirements | ArcGIS Desktop 

MS SQL Server 2017 64-bit version is in the list of supported editions (which also happens to be the version I use).

Just open ArcCatalog, connect to your SQL Server Express instance and create a new geodatabase.

I tried connecting to SQL Server from ArcGIS Server on Windows, it worked (through ArcCatalog and through arcpy). However, when my ArcGIS installation is on Linux , it doesn't work.

(N.B.: This is irrespective of the OS on which the SQL Server instance is running: Linux or Windows)

0 Kudos
DougGreen
Frequent Contributor

Guessing you've already figured this out but we experience this on windows when the native client is not up-to-date or there is a sql driver missing. I would think it could be possible that there is a drive missing?

0 Kudos