CustomMapping class for querying oracle st_geometry functions using C#

683
1
09-11-2012 03:43 AM
Status: Open
srinivasreddy
New Contributor III
As of now, if we want to query ArcSDE Geodatabase which stored in Oracle, We have the following ways
1) Query using ArcObjects classes
2) Query the GeoDataService if we have ArcGIS Server.
3) Query using REST or SOAP API s (If our data is published using ArcGIS Server)

By all the above methods we cann't Query Oracle tables directly. and these are little bit time consuming if geoemtry is complecated.
Instead of with these methods if there is a direct way to query Geodatabse(In oracle or SQL Server) tables using st_geometry functions it will be fast. Actually this method is possible using Oracle.DataAccess.Client library. But we have to implement a CustomMapping class to work with st_geoemtry. If it is possible please implement an custom interface to work with SDE directly with out using any ArcObject classes or an SDEDataAccess dll like oracle dataaccess dll.

Thanks and Regards
V.Srinivasa Reddy
1 Comment
GarySinner
One of our mutual clients (Chevron) ran into a similar problem in our .NET application.  If we try to use the .NET API and the Oracle.DataAccess assembly for querying an Oracle database with an ST_GEOMETRY column, we’re getting a “custom type mapping for typeName=’ST_GEOMETRY’ is not specified or is invalid” exception.  ESRI Tech Support directed us to go to this suggestion and promote it so that maybe their development group will eventually work on creating a library to support direct access through the .NET API.
 
Some code snippets showing what we’re trying to do:
 
        private OracleConnection _dbConn = null;
 
                _dbConn = new OracleConnection(connectionString);
                _dbConn.Open();
 
                 DataSet ds = new DataSet();
                Fill(ds, true);
 
public void Fill(DataSet ds, bool bFillSchema)         {
            try
            {
                OracleDataAdapter da = new OracleDataAdapter(_sSql, _dbConn);

                if (bFillSchema)
                    da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                da.Fill(ds);
                if (bFillSchema)
                    da.FillSchema(ds, SchemaType.Mapped);
            }
            catch (Exception ex)
                                // exception on da.Fill(ds) is caught here


You can reference support incident 1103667 for more details and contact information - we'd be happy to help in any way that we can to resolve this issue.

Thanks,

Gary Sinner
petroWEB