Generic JDBC X/Y Database Table


Named table resources can point to a generic XY table in a JDBC datasource. This is an example of a named table definition for a database table with X/Y geometry columns. This uses the DBDataSourceMetadata element to specify the X and Y geometry columns defined in the database table. The X/Y database table is not expected to have a geometry column.

In this example, the database connection definition to a X/Y table in Oracle is defined using the following tokens. The connection could also be defined as a named connection instead of inline.

It defines a DBDataSourceMetadata element indicating the name of the geometry X and Y columns.

<?xml version="1.0" encoding="UTF-8"?>
<NamedDataSourceDefinition version="MXP_WorkSpace_1_5">
	<DBConnection dbType="oracle">
                <Property name="user" value="scott"></Property>
                <Property name="password" value="tiger"></Property>
		<DBDataSourceDefinition id="ora1">
			<DBTable owner="@owner@" useQuotes="true">table1</DBTable>
				<FeatureXYAttributes srsName="@srsname@">
	<DataSourceRef ref="ora1"/>


Style an X/Y Table

In the X/Y table, it is also possible to add a style to the X/Y table features, either by specifying an existing style column in the table, or define an inline style in the named table.

If the X/Y table has a column which contains the styles per row, it can be used by adding a FeatureStyleAttribute element to the DBDataSourceMetadata element. In the X/Y table example, you would add the FeatureStyleAttribute to the DBDataSourceMetadata, where: @STYLE_ATTRIBUTE@ is the name of the column containing the per row style for the feature.

	<FeatureXYAttributes srsName="@srsName@">
	<FeatureStyleAttribute type="mapbasic">@STYLE_ATTRIBUTE@</FeatureStyleAttribute>


If the X/Y table does not have a column that contains the styles per row, you can use an inline style definition by adding a FeatureStyle element to the DBDataSourceMetadata element. You can use any type of supported FeatureStyle for the X/Y table. For example, you could add a PointStyle to the X/Y feature attributes, where:

	<FeatureXYAttributes srsName="@srsName@">
			<FontSymbol family="@font_name@" size="@font_size@" size-unit="@size_unit@" stroke="@stroke@" stroke-opacity="@opacity@" text="@font_char@"/>