Opened 6 years ago

Last modified 6 years ago

#869 new defect

SQL Azure Support for SQLServer Provider

Reported by: crispinatime Owned by: danstoica
Priority: major Milestone: 3.8.0
Component: SQLServer Spatial Version: 3.8.0
Severity: 3 Keywords:
Cc: External ID:


Currently the SQLServer Provider will not connect to an online SQL Azure hosted database.

SQL Azure solution contains the same datatypes, indexes etc (including spatial Geometry and Geography). However, there are design elements that are not relevant when not running on physical hardware that mean some of the SQLServer commands and capabilities used in the FDO provider code cause connection and schema issues.

This ticket contains a brief description about some changes to make the provider works with SQL Azure. These have been tested with a sample FDO client (MapGuide? v2.5).

Note that these changes only make the connection and reader elements of FDO work with SQL Azure. Schema swapping (use of "USE" is not possible - requires database re-connection) so it was not possible to pass the schema creation tests. Therefore to utilise the reader required a database to already exist.

SQL Azure databases may be created for free to use for testing with a Microsoft account. See

The following issues are addressed in the accompanying patch file:

  1. SQL Azure Does Not Support FILEGROUP_NAME

This is used in FDO and returns the name of the groupId. It does the query over the system table sys.filegroups such as:

select name from sys.filegroups where data_space_id= [groupId]

Both FILEGROUP_NAME function and sys.filegroups table haven’t been supported at current SQL Azure version.

Solution: Temporarily replace it with the constant name ‘primary’ (Still need another permanent solution!)

  1. SQL Azure Does Not Support Access to Other Databases

Solution: Assuming the restriction is to one database within Azure (part of the connection string), just use the current database by removing the [DatabaseName?] part like:

databasename.dbo.syscolumns -> dbo.syscolumns. 

  1. SQL Azure Does Not Support 'sysindexes' Table

Solution: System table named sysindexes may be replaced by sys.indexes in SQL Azure.

As a result, some SQL will be updated as follows: -> sys.indexes.object_id
sysindexes.indid -> sys.indexes.index_id

In the patch file the changes for SQLAzure have been wrapped in a preprocessor IFDEF statement to allow for different builds. Ideally the code can be reviewed and a single common set of SQL created for the provider but this may not be possible. The "SQLServerSpatialSchemaMgr" project requires the following pre-processor directive to be defined in order to build the provider for SQL Azure environment.



Attachments (1)

Azure.patch (4.1 KB) - added by crispinatime 6 years ago.

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by crispinatime

Attachment: Azure.patch added

comment:1 Changed 6 years ago by crispinatime

Component: FDO APISQLServer Spatial
Owner: changed from gregboone to danstoica
Note: See TracTickets for help on using tickets.