connecting to oracle 11g using fdo in map 3d...

18
IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013 © IMAGINiT Technologies www.imaginit.com 1 Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013 AutoCAD Map 3D can connect to a number of external data sources through FDO (Feature Data Objects). This paper describes how to connect to an Oracle 11g database and create and populate a new data store within that database. While this paper describes the process for AutoCAD Map 3D and Oracle 11g, the process should be similar for other versions of the products. Check the Database Settings and Environment Once you have Oracle installed on the server and the Oracle client application installed on the workstation, you are ready to begin using Oracle as a data source for Map 3D. This paper covers the procedure using AutoCAD Map 3D and Oracle 11g. Log into the Database Control Before we start Oracle and Map 3D, let’s check our Oracle environment. We’ll use Oracle’s Database Control utility to do this.

Upload: vanque

Post on 03-Dec-2018

257 views

Category:

Documents


0 download

TRANSCRIPT

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

1

ConnectingtoOracle11gUsingFDOinAutoCADMap3D2013 

 AutoCAD Map 3D can connect to a number of external data sources through FDO (Feature Data Objects).  This paper describes how to connect to an Oracle 11g database and create and populate a new data store within that database.  While this paper describes the process for AutoCAD Map 3D and Oracle 11g, the process should be similar for other versions of the products.   

ChecktheDatabaseSettingsandEnvironment 

 

Once you have Oracle installed on the server and the Oracle client application installed on the workstation, you are ready to begin using Oracle as a data source for Map 3D.  This paper covers the procedure using AutoCAD Map 3D and Oracle 11g.  Log into the Database Control  Before we start Oracle and Map 3D, let’s check our Oracle environment.  We’ll use Oracle’s Database Control utility to do this. 

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

2

 Enter the User Name and Password.  Be sure to connect as the SYSDBA.  

  Check the Listener and Host Entries  Once we’ve logged into the Database Control, we’ll see the details of the database instance. 

  Click on the Listener entry to see the properties. 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

3

 Note the Oracle Home path, the Port (part of the Net Address), and the LISTENER.ORA location.  That path usually should contain at least the following files.  Once you have noted the LISTENER.ORA path, you can log out of the Database Control.  

 The TNSNAMES.ORA file will look something like this.  

# tnsnames.ora Network Configuration File: C:\app\zoidberg\product\11.2.0\dbhome_1\network\admin\tnsnames.ora # Generated by Oracle configuration tools.  MAPAREA =   (DESCRIPTION =     (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))     (CONNECT_DATA =       (SERVER = DEDICATED)       (SERVICE_NAME = maparea.RATC.local)     )   )  LISTENER_MAPAREA = 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

4

  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))   ORACLR_CONNECTION_DATA =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))     )     (CONNECT_DATA =       (SID = CLRExtProc)       (PRESENTATION = RO)     )   )  LISTENER_ORCL =   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))   ORCL =   (DESCRIPTION =     (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))     (CONNECT_DATA =       (SERVER = DEDICATED)       (SERVICE_NAME = orcl.RATC.local)     )   ) 

 Note the HOST and SERVICE_NAME entries.  You will need them when you connect to the data stores through the FDO connections in Map 3D.  Depending on your firewall settings, you also may have to open the listener port (in this case 1521) in the firewall.  In Windows 7, you can do this through the Advanced Settings option of the firewall dialog (Control Panel > Firewall).  Add a new Inbound Rule and select a port as the rule type to create.  Also check the SQLNET.ORA file.  It should look something like this.  

# sqlnet.ora Network Configuration File: C:\app\zoidberg\product\11.2.0\dbhome_1\network\admin\sqlnet.ora # Generated by Oracle configuration tools.  # This file is actually generated by netca. But if customers choose to  # install "Software Only", this file won’t exist and without the native  # authentication, they will not be able to connect to the database on NT.  SQLNET.AUTHENTICATION_SERVICES= (NTS)  NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) 

 Make sure the NAMES.DIRECTORY_PATH contains the TNSNAMES entry.  This is the method used to resolve the names, and refers to the entries in the TNSNAMES.ORA file.  Finally, here’s the LISTENER.ORA file.  You should not have to change anything in here, but you should be aware of its contents.  

# listener.ora Network Configuration File: C:\app\zoidberg\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

5

 SID_LIST_LISTENER =   (SID_LIST =     (SID_DESC =       (SID_NAME = CLRExtProc)       (ORACLE_HOME = C:\app\zoidberg\product\11.2.0\dbhome_1)       (PROGRAM = extproc)       (ENVS = "EXTPROC_DLLS=ONLY:C:\app\zoidberg\product\11.2.0\dbhome_1\bin\oraclr11.dll")     )   )  LISTENER =   (DESCRIPTION_LIST =     (DESCRIPTION =       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))     )   )  ADR_BASE_LISTENER = C:\app\zoidberg 

   

ConnectingtoOracleUsingFDO 

 

Once we’ve established our connection parameters to the Oracle server, we can start using data from there in Map 3D.  In the image below, I’ve established a connection to a SHP source, and have added the data to a map.  These are polygons representing municipal boundaries. 

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

6

  Note the highlighted column headings.  We’re going to use those columns to populate an Oracle data store.  The first step is to connect to Oracle.  Here’s the Data Connect palette.  You can see the existing SHP connection.  Note the Service name for our Oracle connection.  It combines the Host Name and Service Name (Remember the entries in the TNSNAMES.ORA file?).  If an alias has been defined for the service, you could use that, but for this example, we’ll use the actual name. 

  Next, enter the User Name and Password that you have been assigned to connect to the Oracle database. 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

7

  When you’ve logged in successfully, the Data store field will become active.  In this example, we are going to create a new data store based on the SHP data we have displayed in our map.  Select the Add New Data Store entry from the dropdown list. 

  Once you’ve selected the Add New Data Store entry, the Create Oracle Data Store dialog opens.  Fill in the required fields for the Data store name, a password to access the data store (entered a second time for confirmation), and the coordinate system value.  Use the button at the end of the field to open the Select Global Coordinate System dialog.  

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

8

 Be sure to select the appropriate Tablespace for your data store to reside in.  Do not use either the SYSTEM or SYSAUX tablespaces for this type of data store.  Click the OK button in the Create Oracle Data Store dialog when you have finished.  The Accessing Database message box appears, and you can see the progress in the indicator.  

  At this point, the Edit Schema dialog box opens.  You either can edit the schema now, or do it later using the Map Explorer within Map 3D. 

  In this example, I’m going to edit the schema now, so that I’ll be ready to import the data from the SHP file.  Click the Edit Now button.  This opens the Schema Editor dialog.  

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

9

   The left pane of the Schema Editor contains the schemas and object classes within those schemas.  The right pane contains the property sheets for the object selected in the left pane.  Selecting the FeatureClass1 feature class allows us to change some of the properties of that feature class.  I’ve renamed it to Urban_Boundaries.  Use the Apply button to apply the changes.  

  

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

10

You’ll see the following warning.  Click the Yes button to continue.  

  Next, we’ll add additional properties to the feature class, so that we will be ready to copy data into the Oracle data store.  Right click on the feature class entry in the left pane and select the New Property option from the popup menu.  You also can access this from the top menu of the dialog.  

  We’re going to add a property called PPID, which will match the PPID column in the SHP file data.  Using the property sheet in the right pane, fill in the name of the property (PPID) and change its data type to Int32.  Click the Apply button to record the changes. 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

11

  We’ll complete the schema edit by adding the properties UMNM (String, length 20), and UMTYPE (String, length 20).  Here’s what our schema should look like at this point.  

  The Identifier Properties at the feature class level now should look like this. 

  Clicking the OK button in the Schema Editor dialog closes the dialog and takes us back to the Data Connect palette.  You can see the Urban_Areas entry in the Data store field.  The Version field should show a value of LIVE.  If it does not, use the drop‐down list in the field to select it. 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

12

  Click the Connect button to proceed.  The palette shows the SHP and Oracle connections.  We can see the schema containing the Urban_Boundaries feature class.  There is no need to add this data to the map (it’s empty at this point), so we can close the Data Connect palette.  

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

13

We’re ready to load the SHP data into the Oracle data store.  Using the Map Task Pane, right click on the Connect to Data icon at the top of the Display Manager tab and select Bulk Copy from the pop‐up menu.  

  This launches the Bulk Copy dialog.  

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

14

Once you’ve set up the selections to match the preceding image, you’re ready to go.  You may want to set different values for the error checking options.  You can use the Save button to save this schema mapping for future use.  Click the Copy Now button to proceed.  You’ll see the following message.  

  Click the Continue Bulk Copy button to proceed.  When the processing is complete, you’ll see the following dialog.  Use the View Log button to see the details of the copy.  

  Click OK, to close the Bulk Copy dialog.  Taking a look at the Oracle database, we can see the data store we created (URBAN_AREAS) and the table (URBAN_BOUNDARIES) that holds the feature class data.  

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

15

  Here’s a look at the data in the URBAN_BOUNDARIES table.  Note that Oracle has added a couple of columns for its own use. 

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

16

Getting back to Map 3D, we’ll open a new drawing, assign the correct coordinate system and connect to The Oracle database.  Here’s the Data Connect dialog.  We now can select the newly created data store.  

  Connect and add the data to the map.  Note the Urban_Boundaries feature class.  

 

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

17

Here’s the result!  

  

   

IMAGINiT Technologies White Paper Connecting to Oracle 11g Using FDO in AutoCAD Map 3D 2013  

 

 © IMAGINiT Technologies 

www.imaginit.com 

18

AbouttheAuthor:JeffMorrow 

Jeff, a senior civil and geospatial consultant with IMAGINIT, has over thirty years experience in the mining and engineering sectors.  He has been involved with AutoCAD and the Autodesk civil software applications since their earliest days, and has consulted on the development of standards and procedures, CAD management, database and technical applications, training and implementation, and project management. Jeff is recognized for his work in mineral exploration, minesite reclamation and environmental issues.  He is a graduate of McGill University, and is an AutoCAD Civil 3D Implementation Certified Expert.  You can reach him at [email protected]

  All brand names, product names, or trademarks belong to their respective holders. Rand IMAGINiT Technologies, Inc. is not responsible for typographical or graphical errors that may appear in this document. © 2009 Rand IMAGINiT Technologies, Inc., All Rights Reserved.