The IlvSDODataSource class is an IlvMapDataSource for reading georeferenced
objects from an Oracle® SDO
(formerly Oracle Spatial) database. It relies on the Oracle SDO
API that was introduced in former versions of the JViews Maps product, but
wraps up all operations (connecting to database, reading features,
rendering them to graphic objects) in a more convenient way.
To read a map stored in an Oracle SDO
database:
-
Create a connection to the Oracle database:
String url = "jdbc:oracle:thin:@hostMachine:1529:mySID"; String userName="login"; String password="pass"; IlvSDOConnection connection = new IlvSDOConnection(url,userName,password); connection.createConnection();
-
Create a data source with this connection as a parameter:
// Assume we want to read from an object model Oracle database (not relational) boolean isObjectModel = true; // we want to fetch layer "MY_LAYER_GEOMETRY" IlvSDODataSource SDODataSource = new IlvSDODataSource(connection, isObjectModel , "MY_LAYER_GEOMETRY");
To get a list of layers, see Getting a list of layers. -
Set parameters on this data source to use load-on-demand:
boolean useTiling = true; int rowCount = 5; int columnCount = 5; SDODataSource.setTilingParameters(useTiling, rowCount, columnCount);
-
Connect this data source to the manager of the view:
SDODataSource.setManager(getView().getManager());
-
Insert the data source into the data source tree. You first need to retrieve the data source model from the property of the manager:
IlvMapDataSourceModel dataSourceModel = IlvMapDataSourceProperty.GetMapDataSourceModel(manager); dataSourceModel.insert(SDODataSource);
-
Finally, start the Oracle SDO data source:
SDODataSource.start();