FET TheEssentialFDO
FET TheEssentialFDO
May 2006
Copyright© 2006 Autodesk, Inc.
All Rights Reserved
This publication, or parts thereof, may not be reproduced in any form, by any method, for any purpose.
AUTODESK, INC., MAKES NO WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE REGARDING THESE
MATERIALS, AND MAKES SUCH MATERIALS AVAILABLE SOLELY ON AN "AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC., BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE OR USE OF THESE MATERIALS.
THE SOLE AND EXCLUSIVE LIABILITY TO AUTODESK, INC., REGARDLESS OF THE FORM OF ACTION, SHALL NOT
EXCEED THE PURCHASE PRICE OF THE MATERIALS DESCRIBED HEREIN.
Autodesk, Inc., reserves the right to revise and improve its products as it sees fit. This publication describes the state of the
product at the time of publication, and may not reflect the product at all times in the future.
Trademarks
Autodesk, Autodesk Map and Autodesk MapGuide are registered trademarks of Autodesk, Inc., in the USA and/or other
countries. DWF is a trademark of Autodesk, Inc., in the USA and/or other countries. All other brand names, product names or
trademarks belong to their respective holders.
FDO Third Party Software Program Credits
FDO contains certain technology licensed from third parties. The notices and/or other terms and conditions applicable to or
associated with such third party technology are set out below.
Xerces and Xalan are Copyright © 1999-2005, The Apache Software Foundation. Licensed under the Apache License, Version
2.0; you may not use this file except in compliance with the license. You may obtain a copy of the license at the following
web address: http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the license for the specific language governing permissions and limitations under the license.
Libcurl is Copyright © 1996 - 2006, Daniel Stenberg, <[email protected]>. All rights reserved. Permission to use, copy, modify,
and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
Boost is offered under the Boost Software License - Version 1.0, which provides as follows: Permission is hereby granted, free
of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this
license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative
works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:
The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the
following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software,
unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language
processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE
LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
GDAL is Copyright © 2000, Frank Warmerdam. Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright
notice and this permission notice shall be included in all copies or substantial portions of the Software.
GOVERNMENT USE
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in FAR 12.212 (Commercial
Computer Software-Restricted Rights) and DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Published By: Autodesk, Inc.
111 McInnis Parkway
San Rafael, CA 94903, USA
Government Use
1 2 3 4 5 6 7 8 9 10
Contents
iii
Provider Connection Targets . . . . . . . . . . . . . . . . . . . . . . . 19
Provider Registry API . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Connection API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Capabilities API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Command Capabilities . . . . . . . . . . . . . . . . . . . . . . . 28
User Management API . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
User Management Capabilities/SQL Commands . . . . . . . . . . 32
Data Store Management API . . . . . . . . . . . . . . . . . . . . . . . 38
Data Store Management SQL Commands . . . . . . . . . . . . . 43
FdoICreateDataStore . . . . . . . . . . . . . . . . . . . . . 43
FdoIDestroyDataStore . . . . . . . . . . . . . . . . . . . . . 44
FdoIListDataStores . . . . . . . . . . . . . . . . . . . . . . 45
Spatial Context API . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Known Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
MySQL Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Exception Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Connection Not Established . . . . . . . . . . . . . . . . . . . . 49
Incorrect usage of DB GRANT and GLOBAL PRIVILEGES . . . . . 49
Membership of the public role cannot be changed . . . . . . . . 50
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
iv | Contents
The Essential FDO
1
You can use this document is to get up and running with the In this chapter
Feature Data Objects (FDO) API. The Objectives section ■ What Is the Feature Data Objects
API?
provides more information on the topics covered in this
■ Objectives
document. Comments on this document can be sent to ■ Related Documentation
■ Provider Overview
[email protected].
■ System Requirements
■ Installing the FDO SDK
■ Directory Structure
■ Programming Environment
■ Application Tasks
■ C++ Memory Management
■ Collections
■ Provider Connection Targets
■ Provider Registry API
■ Connection API
■ Capabilities API
■ User Management API
■ Data Store Management API
■ Spatial Context API
■ Known Problems
■ Exception Messages
■ Glossary
1
2 | Chapter 1 The Essential FDO
What Is the Feature Data Objects API?
The FDO API provides a generic interface to a number of back-end data source
technologies for storing, retrieving, and updating GIS (Geographic Information
System) data. It also provides a model for extending this interface to additional
data source technologies. A provider is a specifc implementation of the FDO
API that provides access to date stored in a particular data source technology.
For example, the Autodesk FDO Provider for Oracle provides access to GIS
data stored in an Oracle database.
Some data source technologies are file-based, such as SHP and SDF. Others,
such as Oracle and MySQL, use relational databases. FDO has a capabilities
API for determining what operations are supported by each provider of a
particular technology.
Each provider stores feature data. The storage can be modeled as a containment
hierarchy:
■ A data store may contain one or more feature schema and one or more
spatial contexts.
Objectives
The main objective of this document is to provide information to help you
install the FDO SDK and then use it to build applications that connect to and
configure providers. “Configure providers” means creating and deleting user
accounts, granting and revoking database privileges to users, creating and
destroying data stores, and creating and destroying spatial contexts. Not every
provider supports configuration. See Command Capabilities (page 28).
This document identifies the classes and methods you use for connecting to
and configuring providers but does not provide details about their use. For
more information, see the FDO API reference documentation. Doxygen is
used to generate the API reference documentation from comments wrapped
in doxygen tags and embedded in the C++ headers.
Related Documentation
The reference documentation includes this document as well as the following:
NOTE There is no CHM file for the WFS Provider because this provider has no
WFS-specific public API; all of its functionality is accessed through the FDO API.
Autodesk FDO Provider Read/write access to feature data in an Oracle-based data store. Supports
for Oracle spatial indexing, long transactions, and persistent locking. Custom API can
gather provider information, transmit client services exceptions, list data stores,
and create connection objects.
OSGeo FDO Provider Read/write access to feature data in an ESRI ArcSDE-based data store (that is,
for ArcSDE with an underlying Oracle or SQL Server database). Supports describing schema,
and inserting, selecting, updating, and deleting feature data in existing schemas;
does not support creating or deleting schemas.
Autodesk FDO Provider Read/write access to feature data in a Microsoft SQL Server-based data store.
for SQL Server A custom API supports schema read/write access and geospatial and non-
geospatial data read/write access.
OSGeo FDO Provider Read/write access to feature data in a MySQL-based data store. Supports spatial
for MySQL data types and spatial query operations. Custom API can gather information,
transmit exceptions, list data stores, and create connection objects. MySQL
architecture supports various storage engines, characteristics, and capabilities.
OSGeo FDO Provider Read-write access to feature data in an SDF-based data store. Autodesk’s
for SDF geospatial file format, SDF, supports multiple features/attributes, provides high
performance for large data sets, and interoperability with other Autodesk
products. Supports spatial indexing and is a valid alternative to database stor-
age. Note that this release of the SDF provider supports version 3.0 of the SDF
file format.
OSGeo FDO Provider Read/write access to existing spatial and attribute data in an ESRI SHP-based
for SHP data store, which consists of separate shape files for geometry, index, and at-
Provider Overview | 5
Provider Name Description
tributes. Each SHP file and its associated DBF file is treated as a feature class
with a single geometry property. This is a valid alternative to database storage
but does not support locking.
Autodesk FDO Provider Read-only access to feature data in a raster-based file format. Supports various
for Raster image and GIS data formats (for example, JPEG, PNG, MrSID, and others).
Supports georeferenced file-based raster images and file-based grid coverages.
Pixel-based images, such as satellite images, are useful underneath vector data.
OSGeo FDO Provider Read/write to feature data in a ODBC-based data store. Supports XYZ feature
for ODBC objects and can define feature classes for any relational database table with X,
Y, and optionally, Z columns; does not support creating or deleting schema.
Object locations are stored in separate properties in the object definition.
OSGeo FDO Provider Read-only access to feature data in an OGC WFS-based data store. Supports a
for WFS client/server environment and retrieves geospatial data encoded in GML from
one or more Web Feature Services sites. Client/server communication is encoded
in XML with the exception of feature geometries, which are encoded in GML.
Note that there is no public API documentation for this provider; all WFS
functionality is accessible through the base FDO API.
OSGeo Provider for Read-only to feature data in an OGC WMS-based data store. Web Map Service
WMS (WMS) produces maps of spatially referenced data dynamically from geographic
information, which are generally rendered in PNG, GIF, or JPEG, or as vector-
based Scalable Vector Graphics (SVG) or Web Computer Graphics Metafile
(WebCGM) formats.
System Requirements
Software
The following table maps the various providers to the operating system and
RDBMS versions against which they have been tested (T). With the exception
of the SQL Server provider, the RDBMS-based providers require that the
corresponding RDBMS client is installed. Connection to a remote SQL Server
RDBMS
Oracle T T T 10g R1 Server - Standard Edition (32-bit
or 64-bit)
MySQL T T T 5.0.x 2
SDF T T T n/a
SHP T T T n/a
Raster T T T n/a 3
ODBC T T T n/a 4
WFS T T T n/a 5
WMS T T T n/a 6
Software | 7
NOTE
1 The ArcSDE 9.1 client and ArcSDE 9.1 database format are required.
3 The following raster formats are tested: TIFF, MrSID, PNG, JPG, JPG2K,
DEM, DTED, ECW, ESRI ascii grid, and ESRI binary grid.
Component Notes
Disk (MB)
FDO SDK (inc, lib, docs, and sample directories) 242 n/a 1
Disk (MB)
A small example program 55 7-27 3
(FDO Command-line Interpreter sample)
(devenv.exe)
(mysqld-nt.exe)
4 The disk and memory size shown are for Visual Studio and .NET
framework combined.
5 The disk size includes the Oracle Db_1 directory only; it does not include
the default database or administration directories. The memory size is an
approximate sum of the memory sizes for an Oracle instance running as
a service. The processes are oracle.exe, tnslsnr.exe, and
isqlplussvc.exe. The Oracle instance includes both client and server
components. There is also a separate client application.
9 The ArcSDE client disk size is reflected in the total, but the memory size
would be included in that of the running FDO application.
Enterprise Edition
This edition contains the following providers: ArcSDE, MySQL, ODBC, Oracle,
Raster, SDF, SHP, SQL Server, WFS, and WMS. The following description covers
the installation of the FDO SDK and the ArcSDE 9.1 client. It does not cover
the installation of the Oracle and SQL Server clients and servers or the
installation of the ArcSDE server or the installation of MySQL.
Windows XP
The FDO SDK is divided into two parts. The first part consists of the DLLs,
which are bundled with the Autodesk Map® 3D 2007 product. The second
part is the header files, library files, documentation, and sample code. These
components are bundled with the Autodesk Map ObjectARX SDK.
Autodesk Map 3D 2007 is installed from a CD-ROM. For more information,
see the Autodesk Map 3D documentation. After you have installed Autodesk
Map 3D, the FDO DLLs are located in C:\Program Files\Autodesk Map
3D\FDO\bin.
The Autodesk Map ObjectARX SDK can be downloaded and installed from
the Developer Center on the Autodesk web site.
2 Review the Notice To User and fill in the requested information form.
3 Click the radio button beside the statementI Accept The License
Agreement. Download ObjectARX for Autodesk Map 3D 2007 (includes
FDO SDK 3.0).
6 Unzip the file. By default the file is unzipped to C:\Map ObjectARX SDK\.
If you plan to use the FDO Provider for ArcSDE, you must obtain the ArcSDE
9.1 client DLLs (sg91.dll, sde91.dll, and pe91.dll). Add the absolute path
name of the folder containing the client DLLs to the system PATH environment
variable.
Community Edition
The FDO source code is available along with the MapGuide® Open Source
code. The source code for the Oracle, SQL Server, and Raster providers is not
available as open source. For more information about this project, see the
Open Source Geospatial Foundation at www.OSGeo.org.
Enterprise Edition
Windows
Directory Structure | 13
XmlSchema\
GML\
<xsd files>
XLink\
CopyRight.txt
xlinks.xsd
XmlSchema\
base.css
datatypes.xsd
XmlSchema.xsd
W3C Software License.html
<xsd files>
ReadMe.txt
inc\
ATILSession\
3 files
common\
Gml212\
2 files
Io\
8 files
Xml\
12 files
Xsl\
1 file
fdo\ 6 files
ClientServices\ 8 files
Commands\ 11 files
DataStore\ 5 files
Feature\ 9 files
Locking\ 11 files
LongTransaction\ 26 files
Network\ 10 files
Schema\ 10 files
SpatialContext\ 7 files
Sql\ 2 files
Topology\ 6 files
UnitOfMeasure\ 5 files
Geometry\ 28 files
AgfGeometry\ 1 file
GeometryStream\ 3 files
RasterFile\ 1 file
Override\9 files
Rdbms\ 12 files
Override\ 22 files
MySQL\ 20 files
ODBC\ 10 files
Oracle\ 23 files
SqlServer\ 20 files
SDF\ 2 files
Shp\ 2 files
Override\ 6 files
Utilities\ 5 files
BulkCopy\ 7 files
Schema\ 1 file
UserMgr\ 2 files
WMS\ 1 file
Override\9 files
lib\ 18 files
sample\
APIDocSandbox\ 30 files
DevGuideExample\ 44 files
OdbcSample\ 9 files
ProviderCapabilities\ 6 files
ProviderList\ 6 files
RasterFile\ 11 files
SampleArxApp\ 5 files
Enterprise Edition | 15
About the Samples
The following sample programs are included with the FDO SDK:
Programming Environment
The FDO API is written in C++. The class references in this document are to
C++ classes. An equivalent managed class interface is also available in Windows.
NOTE The use of the /Yu option (use precompiled headers) on the compile-line.
Compile-Line Options
/Od /I "..\..\..\..\inc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D
"_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h"
/Fp"Debug\CIMain.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /nologo
/c /Wp64 /ZI /TP /errorReport:prompt
Link-Line Options
/OUT:"<somePath>\CIMain.exe" /INCREMENTAL /NOLOGO
/LIBPATH:"..\..\..\..\lib" /MANIFEST
/MANIFESTFILE:"Debug\CIMain.exe.intermediate.manifest" /DEBUG
/PDB:"<somePath>\CIMain.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86
/ERRORREPORT:PROMPT FDO.lib GisCommon.lib FDORdbms.lib BulkCopy.lib
FDOATILSession.lib RFPOverrides.lib FDOWmsOverrides.lib
GisGeometry.lib OdbcOverrides.lib ShpOverrides.lib MySQLOverrides.lib
Application Tasks
This document describes the following tasks. The various user-related and data
store-related tasks are not supported by all providers. See the sections describing
these APIs for details.
5 Get a spatial context. For more information, see Spatial Context API (page
45).
OSGeo.ODBC.3.0 DataSourceName=Cities 1
Autodesk.Raster.3.0 DefaultRasterFileLocation=C:\Map
ObjectARX SDK\FDO\sample\Raster-
File\lefttop.jpg
OSGeo.WFS.3.0 FeatureServer=http://www.bsc-
eoc.org/cgi-bin/bsc_ows.asp
OSGeo.WMS.3.0 FeatureServer=
http://wms.jpl.nasa.gov/wms.cgi
NOTE
1 This assumes that you followed the procedure to map a data source name
to a file. This is specified in the notes for the DataSourceName property
in the connection properties table in Connection API (page 20). The file
is Cities.mdb, and it is located in <FDO SDK Install
Location>\sample\OdbcSample\.
Collections | 19
Provider Registry API
Use the FdoFeatureAccessManager::GetProviderRegistry static method to
create an IProviderRegistry object. Query this object to get information about
the providers available in this distribution. This information is also available
in the XML file C:\Program Files\Autodesk Map 3D\FDO\bin\providers.xml.
Connection API
You can use this API to connect to a provider. In general do the following:
4 Use the dictionary to query and set the properties required for the
connection.
NOTE Some providers having a data store property (ArcSDE, Oracle, MySQL, and
SQL Server) support the existence of multiple data stores. You can only connect
to one data store. To get a list of the available data stores, you must set the rest
of the connection properties (Username, Password, and Service for all 4 providers
plus the Instance property for the ArcSDE provider) and call the connection object's
open method. The result is a pending connection state, and the data store property
in the connection property dictionary is populated with the list of data stores. The
data store property can then be set to one of the data store names in the list and
another call made to the open method. This should result in an open connection
state.
Datastore
Provider/Properties Notes
Default Value
Enumerable
Protected
Filepath
Required
Filename
OSGeo.ArcSDE.3.0
Server T F F F F F 1
Instance T F F F F F 2
Username T F F F F F 3,4
Password T T F F F F 3,4
Datastore F F F F T T 5,6
OSGeo.MySQL.3.0 7
Username T F F F F F 8
Password T T F F F F 8
Service T F F F F F 9
DataStore F F F F T T 10
OSGeo.ODBC.3.0 11
DataSourceName F F F F F T 12
UserId F F F F F F 13
Connection API | 21
Datastore
Provider/Properties Notes
Default Value
Enumerable
Protected
Filepath
Required
Filename
Password F T F F F F 13
ConnectionString F F F F F F
GenerateDefaultGeometryProperty True F F F F F F
Autodesk.Oracle.3.0 14
Username T F F F F F 8
Password T F F F F F 8
Service T F F F F F 15
DataStore F F F F T T 16
Autodesk.Raster.3.0 17
DefaultRasterFileLocation F F F F F F 18
OSGeo.SDF.3.0 19
File T F T F F F 18
ReadOnly False F F F F F T 20
OSGeo.SHP.3.0 21
DefaultFileLocation F F T F F F 22
Default Value
Enumerable
Protected
Filepath
Required
Filename
TemporaryFileLocation F F T F F F 23
Autodesk.SqlServer.3.0 24
Username F F F F F F 25
Password F T F F F F 25
Service T F F F F F 26
DataStore F F F F T T 27
OSGeo.WFS.3.0
FeatureServer T F F F F F
Username F F F F F F
Password F F F F F F
OSGeo.WMS.3.0
FeatureServer T F F F F F
Username F F F F F F
Password F F F F F F
DefaultImageHeight F F F F F F
Connection API | 23
NOTE
1 The value of the Server property is the name or IP address of the host
where the ArcSDE 9.1 Server instance runs.
2 The value of the Instance property defines the port and protocol to use
when communicating with the ArcSDE server. This instance name must
be mapped to the TCP/IP listen port used by the Server to accept
connection requests. This mapping is stored in the
C:\WINDOWS\system32\drivers\etc\services file and has the form
"instance_name portnum/protocol # comment". For example,
"esri_sde_oracle 5151/tcp #ArcSDE Server listening port". There
can be multiple instances because the server can connect to multiple
back-end database technologies, for example, both Oracle and SQL Server.
3 You must create the username and password from the sqlplus
command-line when FDO Providerfor ArcSDE is using Oracle as the
back-end database technology.
1 sql> connect sys/password as sysdba
4 You must create the username and password from the Enterprise Manager
when FDO Provider for ArcSDE is using SQL Server as the back-end
database technology. The following procedure adds a new login user
named name with password password who must login to the SQL Server
using SQL Server authentication. The user named name is given the global
privilege, Database Creators, and is added to a database with privileges,
db_ddladmin, db_datareader, and db_datawriter.
1 On the Windows Start menu, click Programs, click Microsoft SQL
Server, click Enterprise Manager.
3 In the SQL Server Login Properties - New Login dialog box, click the
tab labeled General, type name in the text entry box labeled Name,
click the radio button labeled SQL Server Authentication, type a
password in the text entry box labeled Password.
5 Click the tab labeled Database Access, click the check-box in the
column labeled Permit next to the name of the database to which
you are adding this user, click the check-boxes in the column labeled
Permit in Database Role next to the labels db_ddl_admin,
db_datareader, and db_datawriter.
7 In the Confirm Password dialog box, type password in the text entry
box labeled Password, click OK.
8 In the SQL Server Login Properties - New Login dialog box, click OK.
5 When FDO Provider for ArcSDE is using Oracle as the back-end database,
the value of DataStore is always 'Default Datastore'.
6 When FDO Provider for ArcSDE is using SQL Server as the back-end
database, the value of DataStore is one of the values in the list of databases
supported by that instance of the SQL Server.
9 The value of the Service property is localhost for a local connection and
a valid domain name for a remote connection. A firewall at the remote
end can prevent a connection from succeeding. However, note that the
exception message will not tell you that this is the cause.
11 Initially, you use this provider to access feature source files created using
either MS Access or Excel.
Connection API | 25
12 Use a Windows OS administrative tool to define a DSN (data source
name). This action associates a symbolic name with a file path. Do the
following to add a User DSN for a Microsoft Access database file.
1 On the Windows Start menu, click Settings, click Control Panel,
click Administrative Tools, click Data Sources (ODBC). The ODBC
Data Source Administrator dialog box is displayed.
2 In the Data Source Administrator dialog box, click User DNS , click
Add. The Create New Data Source dialog box is displayed.
3 In the Create New Data Source dialog box, click Microsoft Access
Driver (*.mdb), click Finish. The ODBC Microsoft Access Setup dialog
box is displayed.
4 In the ODBC Microsoft Access Setup dialog box, in the text entry
box labeled Data Source Name , type the name of the data source,
click Select. The Select Database dialog box is displayed.
5 In the Select Database dialog box, select directory, select file, click
OK.
16 An Oracle instance can contain many data stores. Follow the instructions
in the note attached to the connection procedure that precedes this table
to obtain a list of the available data stores.
17 See the list of raster file formats supported by this provider in System
Requirements (page 6).
18 This is a file name. The named file is in the local file system.
21 The SHP provider supports the .shp file type and the .dbf file type.
25 If your Windows user name has been added to the remote SQL Server by
an administrator or you are connecting to the SQL Express instance on
your local machine, you do not have to provide values for the Username
and Password properties. If you are connecting by way of SQL Server
Authentication, you must provide a user name and password that has
been added by an administrator. If you connect to a SQL Server instance
with administrator privileges, you can use the FDO User Management
API to add users.
26 If you can see the server name in the list of SQL Servers known to the
ODBC Data Source Administrator, then you can connect to it using FDO.
Use the name of the remote SQL Server as it appears in the list as the
value of the Service property. If you want to connect to the SQL Express
instance running on the local host, use <hostname>\SQLEXPRESS or
.\SQLEXPRESS as the value of the Service property. Be sure the the SQL
Server service is running on the local machine. To see the list of remote
SQL Servers, do the following:
1 In the Windows Start menu, click Settings, click Control Panel, click
Administrative Tools, click Data Sources (ODBC). The ODBC Data
Source Administrator dialog box is displayed.
2 In the ODBC Data Source Administrator dialog box, click the User
DSN tab, click Add. The Create New Data Source dialog box is
displayed.
3 In the Create New Data Source dialog box, scroll down and select
SQL Server, click OK. The Create a New Data Source to SQL Server
dialog box is displayed.
4 In the Create a New Data Source to SQL Server dialog box, click the
down arrow-head on the spin box labeled Server to make the list of
SQL Servers visible.
Connection API | 27
27 In SQL Server terms this is a database. If your connection to the SQL
Server is in a pending state, you can create a data store using theData
Store Management API (page 38). Once you have created the data store,
you can connect to it by setting the DataStore connection property and
calling the connection object’s Open method again.
Capabilities API
You can use this API to determine what capabilities to expose or hide in the
user interface depending on the current provider.
You access the Capabilities API by way of the connection object. The
availability of this API is not dependent on the connection state; it is always
available. This static definition represents the maximum set of capabilities
available through the current provider under optimum conditions. For
example, the capabilities API says that the Oracle provider supports the update
command; however, the execution of an update command could throw an
exception because the user has not been granted access to the table to be
updated. In this example, the update capability is conditional on user privilege.
The exception message provides the additional information you need to use
the capability successfully.
Use the FdoIConnection object to obtain the capability objects whose class
names are FdoICommandCapabilities, FdoIConnectionCapabilities,
FdoIExpressionCapabilities, FdoIFilterCapabilities,
FdoIRasterCapabilities, FdoISchemaCapabilities, and
FdoITopologyCapabilities.
Command Capabilities
Use the FdoIConnection object's GetCommandCapabilitiesmethod to get the
list of commands and related attributes supported by the provider. The list of
commands is shown in the first table. The command attributes are shown in
Command Notes
SqlServer
ArcSDE
MySQL
Oracle
ODBC
Raster
WMS
WFS
SHP
SDF
Select Y Y Y Y Y Y Y Y Y
SelectAggregates Y Y Y Y Y Y Y Y Y
Insert Y Y Y Y Y Y Y
Delete Y Y Y Y Y Y Y
Update Y Y Y Y Y Y Y
DescribeSchema Y Y Y Y Y Y Y Y Y Y
DescribeSchemaMapping Y Y Y Y
ApplySchema Y Y Y Y Y
DestroySchema Y Y Y Y
ActivateSpatialContext Y Y Y Y Y
CreateSpatialContext Y Y Y Y Y
DestroySpatialContext Y Y Y Y
GetSpatialContexts Y Y Y Y Y Y Y Y Y Y
CreateDataStore Y Y Y Y 1
Command Capabilities | 29
Command Notes
SqlServer
ArcSDE
MySQL
Oracle
ODBC
Raster
WMS
WFS
SHP
SDF
DestroyDataStore Y Y Y Y 1
ListDataStores Y Y Y
CreateSDFFile Y
SQLCommand Y Y Y Y Y
AcquireLock Y Y
GetLockInfo Y Y
GetLockedObjects Y Y
GetLockOwners Y Y
ReleaseLock Y Y
ActivateLongTransaction Y Y
CommitLongTransaction Y Y
CreateLongTransaction Y Y
DeactivateLongTransaction Y Y
FreezeLongTransaction
GetLongTransactions Y Y
SqlServer
ArcSDE
MySQL
Oracle
ODBC
Raster
WMS
WFS
SHP
SDF
RollbackLongTransaction Y Y
CreateSpatialIndex Y Y Y
DestroySpatialIndex Y Y Y
GetSpatialIndexes Y Y Y
Attribute Notes
SqlServer
ArcSDE
MySQL
Oracle
ODBC
Raster
WMS
WFS
SHP
SDF
Parameters Y
Timeout
SelectExpressions Y Y Y Y Y Y
SelectFunctions Y Y Y Y Y Y Y
SelectDistinct Y Y Y Y Y Y Y
SelectOrdering Y Y Y Y Y Y
SelectGrouping Y Y Y Y
Command Capabilities | 31
NOTE
1 The capability to create and destroy a data store is associated with the
capability to create and destroy a feature schema. To create a data store
you specify values for data store properties. For more information about
these properties are discussed in Data Store Management API (page 38).
= ‘pwd’; exec
sp_addsrvrolemem-
ber @loginname =
‘name’ @rolename
= ‘dbcreator’
Temp_RoleMem-
bers52 execute
sp_helprolemem-
ber; drop table
Temp_RoleMem-
bers52
‘username’; exec
sp_addrolemember
@rolename =
‘db_ddladmin’
@membername =
‘username’
2 The new Oracle user is assigned the F_USER_ROLE role. The SQL statement
used to obtain this information is select granted_role from
sys.dba_role_privs where grantee = 'username';. A new Oracle user
is assigned the 'unlimited tablespace,' 'execute any indextype,' and 'execute
any procedure' privileges. The SQL statement used to obtain this
information is select privilege from sys.dba_sys_privs where
grantee = 'username'; A new Oracle user is assigned a long list of
privileges as a result of being assigned the role of F_USER_ROLE. You can
determine the contents of this list using the SQL statement select
privilege from sys.role_sys_privs where role = 'F_USER_ROLE';
The list is drop user, alter user, analyze any, create user, alter
session, drop any view, create session, drop any index, drop any
table, grant any role,lock any table, alter any index, alter any
table, create any view, create any index, create any table, create
procedure, delete any table, drop any synonym, insert any table,
select any table, update any table, drop any sequence, alter any
sequence, create any synonym, create any sequence, grant any
privilege, select any sequence, global query rewrite, and grant any
object privilege. The F_USER_ROLE also has default table privileges.
You can determine what these are by the SQL statement select
table_name,privilege from sys.role_tab_privs where role =
'rolename';
3 A new SQL Server user created using the stored procedure sp_login is
given one system privilege db_creator. The user can login using SQL
Server authentication. Call GrantAccessToDatastore(username, datastore)
to grant the user default privileges for the data store.
5 User privileges extend across all data stores defined in the Oracle instance.
7 You can get the same information from the connection properties
dictionary for the DataStore property. The MySQL SQL command mysql>
show databases; lists the database (data store) names. In Oracle, user
names and data store names are classed as Oracle users. The Oracle SQL
command SQL> select username from dba_users; shows data store and
user names
8 All users are listed. SQL Server reports the user privileges as well as the
user name. If you are connected to MySQL and you created the user with
AddUser, USAGE is shown as the privilege. If you are connected to SQL
Server and you created the user with AddUser, db_creator is shown as the
privilege.
9 All users in a particular data store are listed along with the privileges that
they have in the data store. If connected to MySQL and you used the
two-argument version of GrantAccessToDatastore, the privileges are
listed in the note for that method.
14 This overloaded method takes three arguments: a user name, a data store
name, and a privilege name. It grants the specified privilege to that user
for the named data store. The MySQL provider does not allow you to
grant any privilege other than those assigned by a call to
GrantAccessToDatastore(<user>, <datastore>). The SQL Server provider
does allow you to grant any of the supported privileges with the exception
of the publicprivilege. Call GetDBUsers(<datastore>) to verify the result.
15 This method takes three arguments: a user name, a data store name, and
a privilege name. It revokes the specified privilege from that user for the
named data store. If the role is set to ‘*’, the provider revokes all privileges
in the data store from the user. In this case the SQL Server provider also
drops the database user from the data store; the user’s login status is not
changed.
16 This method takes two arguments: a user name and a role or privilege
name. It revokes the specified role or privilege.
17 If True, you can call the two GrantAccessToDatastore methods and the
RevokeAccessToDatastore method.
The procedure used for creating and destroying a data store in an RDBMS-based
provider is slightly different than the procedure used for these operations in
the SDF provider. The key difference is that the connection to the RDBMS-based
■ f_associationdefinition
■ f_attributedependencies
■ f_classdefinition
■ f_classtype
■ f_dbopen
■ f_lockname
■ f_options
■ f_sad
■ f_schemainfo
■ f_schemaoptions
■ f_sequence
■ f_spatialcontext
■ f_spatialcontextgeom
■ f_spatialcontextgroup
SDF Provider
2 Verify these operations by looking in the file system. The SDF provider
does not support the FdoIListDataStores command.
This table shows the data store management properties for each provider. “T”
means true, and “F” means false. For important details, refer to the associated
Notes.
Datastore
Provider/Properties Notes
Default Value
Enumerable
Protected
Required
Filename
OSGeo.MySQL.3.0
DataStore T F F T F 1
Description F F F F F
Autodesk.Oracle.3.0
DataStore T F F T F 1
Password T T F F F 2
Description F F F F F
LtMode OWM F F F F T 3
TableSpace F F F F F 4
OSGeo.SDF.3.0
File T F T F F 5
Autodesk.SqlServer.3.0
DataStore T F F T F 1
Default Value
Enumerable
Protected
Required
Filename
Password T T F F F 2
Description F F F F F
LtMode FDO F F F F T 3
LockMode FDO F F F F T 6
NOTE
1 A data store is a container in the data source to which you can apply a
feature schema.
5 The File property takes a file name value. The named file is in the local
filesystem.
FdoICreateDataStore
Oracle
SQL Server
MySQL
FdoIDestroyDataStore
MySQL
Oracle
SQL Server
SQL Server
For each database the following SQL is executed.
Properties/Provider Notes
SqlServer
MySQL
Oracle
SDF
SqlServer
MySQL
Oracle
SDF
Extent Not Not NULL Not 2
NULL NULL NULL
NOTE
1 A static extent type means that the extent is defined at the time of the
creation of the spatial context using the FdoICreateSpatialContext
command. A dynamic extent type means that the extent may change as
features are added so that it always encloses all of the features.
2 The default extents expressed in AGF text format for the various providers
are as follows:
■ MySQL, Oracle and SQL Server: POLYGON ((-2000000 -2000000,
2000000 -2000000, 2000000 2000000, -2000000 2000000, -2000000
-2000000))
5 Only ArcSDE, MySQL, Oracle and SQL Server providers can have multiple
spatial contexts defined and can, therefore, show contexts in the reader
that are not active.
Properties/Provider Notes
ODBC
Raster
WMS
WFS
Coordinate System Carte- Carte- EPSG:4326 EPSG:4326 1
sian sian
Unit dimension XY XY XY XY 4
Active F T F F 6
2 A static extent type means that the extent is defined at the time of the
creation of the spatial context using the FdoICreateSpatialContext
command. A dynamic extent type means that the extent may change as
features are added so that it always encloses all of the features.
■ WMS: POLYGON ((-180 -90, 180 -90, 180 90, -180 90, -180 -90))
6 Only ArcSDE, MySQL, Oracle and SQL Server providers can have multiple
spatial contexts defined and can, therefore, show contexts in the reader
that are not active.
MySQL Provider
This provider was throwing exceptions because the FDO program was loading
a version of the libMySQL.dll from the PHP installation rather than the MySQL
installation. The problem was corrected by placing the PHP path after the
MySQL path in the system PATH variable.
Exception Messages
Known Problems | 49
Membership of the public role cannot be changed
This exception message occurs when there is a pending connection to SQL
Server and a call is made to GrantAccessToDatastore(<user>, <datastore>,
L”public”).
Glossary
Tolerance
Used to determine when two points are close enough to be considered to be
equivalent in certain spatial tests. In FDO, the tolerance value is used as a
radius around a position rather than as a distance along an axis. In the majority
of cases, the distance between the points is compared to the tolerance using
the 'less than or equals to' predicate rather than the 'less than' predicate. If
the X and Y tolerances are both 0.05, then point B (1.0, 1.0) is considered to
be equivalent to point A (0.96, 0.96) and point C (1.04, 1.04), but is not
considered to be equivalent to point D (0.96, 0.94) or point E (1.04, 1.06). The
relationship is not commutative. That is, point A is not equivalent to point
C. Repeated applications of the isEquivalentTo predicate to the same data
always yields the same result.
51 | Index
AssignRoleOrPrivilege 32 GenerateDefaultGeometryProperty22
CreateConnection 20 Instance 20–21, 24
DropUser 32 LockMode 42
GetCommandCapabilities 28, 32 LtMode 41–42
GetDatastores 32 Password 20–23, 27, 41–42
GetDbUsers 33, 36, 38 ReadOnly 22
GetRolesOrPrivileges 34, 49 Server 21, 24
GrantAccessToDatastore 34–38, 49– Service 20–23, 25–27
50 TableSpace 41–42
RevokeAccessToDatastore 35, 38 TemporaryFileLocation 23, 27
RevokeRoleOrPrivilege 35 UserId 21
SupportDataStoreGrants 32 Username 20–23, 27
SupportsDataStoreGrants 35 Provider Registry API 20
SupportsWindowsAuthentication 35
Microsoft Access 8, 25–26
Microsoft Excel 8, 25
R
MySQL database 3, 7, 9–10, 25, 36 raster file formats 7–8, 26
RDBMS 5–6, 38
O roles, Oracle 36, 38
52 | Index