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:

Description

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 http://www.windowsazure.com/en-us/pricing/free-trial/


The following issues are addressed in the accompanying patch file:

  1. SQL Azure Does Not Support FILEGROUP_NAME
FILEGROUP_NAME( groupId ):

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
    [DatabaseName].dbo.syscolumns

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
sysindexes 

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

As a result, some SQL will be updated as follows:

sysindexes.id -> 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.

#ifdef SQL_AZURE_MODE

References:
http://blog.sqlauthority.com/2010/06/04/sql-server-generate-database-script-for-sql-azure/

http://blogs.architectingconnectedsystems.com/blogs/cjg/archive/2011/12/26/SQL-Azure-supported-tables_2F00_views.aspx

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.