Granting Network Access Creating a MapViewer Client Handle

6-2 Oracle Fusion Middleware Users Guide for Oracle MapViewer

6.2 Using the SDO_MVCLIENT Package

The SDO_MVCLIENT PLSQL package communicates with a remote MapViewer service through the HTTP protocol. For each database session, it maintains a global MapViewer client handle, as well as the current map request and map response objects. The usage model for the SDO_MVCLIENT package is almost identical to that of MapViewer JavaBean-based API described in Chapter 4 . Most methods implemented in the MapViewer JavaBean-Based API oracle.lbs.mapclient.MapViewer are available in this PLSQL package, and the package uses the same method names and parameters used by the JavaBean-Based API. For usage and reference information about specific functions or procedures, see the description of the associated JavaBean-Based API. methods and interfaces in Chapter 4 . The basic workflow for accessing the MapViewer service through this PLSQL package is almost identical to that for using the Java client API, except for some initial setup. Follow these major steps, each of which is described in a section to follow: 1. Grant network access see Section 6.2.1 . 2. Create a MapViewer client handle see Section 6.2.2 . 3. Prepare a map request see Section 6.2.3 . 4. Send the request to the MapViewer service see Section 6.2.4 . 5. Optionally, extract information from the map request see Section 6.2.5 .

6.2.1 Granting Network Access

Grant network access permission to each database user that will use the SDO_ MVCLIENT package. For example, if database user SCOTT will need to use the package, you must enter a statement in the following general form while connected as a user with DBA privileges: call dbms_java.grant_permissionSCOTT, SYS:java.net.SocketPermission, www.mycorp.com, connect, resolve ; In the preceding example, change www.mycorp.com to the host on which the MapViewer service is running. Depending on the Oracle Database version, you may also need to grant network access to the database user MDSYS, which owns the SDO_MVCILENT package. To do this, enter a statement in the following general form while connected as a user with DBA privileges: call dbms_java.grant_permissionMDSYS, SYS:java.net.SocketPermission, www.mycorp.com:8888, connect, resolve ; In the preceding example, change www.mycorp.com to the host on which the MapViewer service is running. The call to dbms_java.grant_permission needs to be done only once for each affected database user; the permission remains valid for all subsequent database sessions for these users. MapViewer PLSQL API 6-3

6.2.2 Creating a MapViewer Client Handle

Before each database session, you must create a MapViewer client handle before using any functions or procedures of the SDO_MVCLIENT package. The following example creates a MapViewer client handle: connect scott Enter password: password call sdo_mvclient.createmapviewerclient http:www.mycorp.com:8888mapvieweromserver ; The preceding example creates, in the current session, a unique MapViewer client handle to the MapViewer service URL http:www.mycorp.com:8888mapvieweromserver. To use this example, change www.mycorp.com to the host on which the MapViewer service is running. After you have created a MapViewer client handle, you can perform the following query to check that MapViewer is running correctly: select sdo_mvclient.getdatasources datasources from dual; The SQL function sdo_mvclient.getdatasources is part of the MapViewer PLSQL package API; and when it is executed, it connects to the remote MapViewer server and gets a list of all known data sources. If the installation is successful and the MapViewer server is running, the result of the preceding example is output similar to the following, with the string array containing the names of the data sources that are defined in the MapViewer server: DATASOURCES -------------------------------------------------------------------------------- SDO_1D_STRING_ARRAYmvdemo, wms

6.2.3 Preparing a Map Request