Alternate Style Database Table

Example

This is an example of a named table definition for an Oracle database table with alternate style column. This uses the DBDataSourceMetadata element to specify the geometry column and the alternate style column defined in the database table.

Note: Alternate style columns can be defined in any supported database type by changing the connection definition.

In this example, the database connection definition to the Oracle table is defined using the following tokens:

  • @owner@ the owner name of the Oracle table
  • @host@ the host name used to connect to the Oracle database
  • @port@ the port number used to connect to the Oracle database
  • @SID@ the SID for the Oracle instance
  • @username@ the user credentials for accessing the database
  • @password@ the password credentials for accessing the database

In addition, it defines a DBDataSourceMetadata element indicating the name of the geometry column and style columns to use for the alternate styling of the table.

  • @srsname@ the name of the coordinate system for the spatial geometries in @geometrycolumn@
  • @geometrycolumn@ the name of a feature attribute containing a spatial geometry object
  • @styletype@ the type of the style attribute @stylecolumn@
  • @stylecolumn@ the attribute that contains the per feature style
<?xml version="1.0" encoding="UTF-8"?>
<NamedDataSourceDefinition version="MXP_WorkSpace_1_5">
	<DBConnection dbType="oracle">
        <ConnectionName>/myOracleConnection</ConnectionName>
        <JDBCDriverParameters>
            <JDBCUrl>jdbc:oracle:thin:scott/tiger@localhost:1521:MyDB</JDBCUrl>
            <DriverPropertySet>
                <Property name="user" value="scott"></Property>
                <Property name="password" value="tiger"></Property>
            </DriverPropertySet>
        </JDBCDriverParameters>
    </DBConnection>
	<DataSourceDefinitionSet>
		<DBDataSourceDefinition id="ora1" volatile="true">>
			<DataSourceName>oracle2</DataSourceName>
			<DBTable owner="@owner@" useQuotes="true">table2</DBTable>
			<DBDataSourceMetadata>
				<FeatureGeometryAttribute srsName="@srsname@">@geometrycolumn@</FeatureGeometryAttribute>
				<FeatureStyleAttribute type="@styletype@">@stylecolumn@</FeatureStyleAttribute>
			</DBDataSourceMetadata>
		</DBDataSourceDefinition>
	</DataSourceDefinitionSet>
	<DataSourceRef ref="ora1"/>
</NamedDataSourceDefinition>