Home » Server Options » Spatial » SDO_GEOMETRY & ODP.NET
SDO_GEOMETRY & ODP.NET [message #75801] Wed, 05 February 2003 04:19 Go to next message
Miro
Messages: 1
Registered: February 2003
Junior Member
Does anybody know how to fetch data of type MDSYS.SDO_GEOMETRY with the ODP.NET data provider?

thanks
Miro
Re: SDO_GEOMETRY & ODP.NET [message #75802 is a reply to message #75801] Thu, 20 February 2003 06:25 Go to previous messageGo to next message
Rudy Van den Bergh
Messages: 1
Registered: February 2003
Junior Member
Bumping this because i have the same question.
Re: SDO_GEOMETRY & ODP.NET [message #290510 is a reply to message #75802] Sat, 29 December 2007 05:09 Go to previous messageGo to next message
peterl
Messages: 12
Registered: September 2007
Junior Member
You can concatenate the ordinates and the elements in 2 clobs. You can seperate the numbers with | characters. It is clumsy but it works.

If you convert the numbers to a clob you have to worry about de decimal seperator (parameter NLS_NUMERIC_CHARACTERS from v$nls_parameters).

You can also use XML. See also http://forums.oracle.com/forums/thread.jspa?threadID=241076 .

The new odp.net version supports user defined datatypes. So it should support sdo_geometry. I didn't test this new version.

Re: SDO_GEOMETRY & ODP.NET [message #290544 is a reply to message #290510] Sat, 29 December 2007 12:57 Go to previous messageGo to next message
peterl
Messages: 12
Registered: September 2007
Junior Member
Odp.net Release 11.1.0.6.20 supports user defined datatypes. With the use of attributes you can map .Net types and Oracle types like mdsys.sdo_geometry.

Download and install this release of odp.net . You will find an example with sdo_geometry in the solution ...\ODP.NET\samples\2.x\udt.sln . Project object3.csproj in this solution covers sdo_geometry.







Re: SDO_GEOMETRY & ODP.NET [message #296419 is a reply to message #290510] Sat, 26 January 2008 14:24 Go to previous messageGo to next message
peterl
Messages: 12
Registered: September 2007
Junior Member
Solution for sdo_geometry and odp.net:

I have made an example, it is an C# 2.0 console application.

userid=scott/tiger@ora11, but you can change the connection. It should work with Oracle server 9,10 and 11.

This example has two generic<> base classes (OracleArrayType and OracleCustomTypeBase), that you can also use with other UDTs, not only for sdo_geometry ( I hope).

There are 5 cs files: Program.cs, OracleArrayTypeFactory.cs, OracleCustomTypeBase, SdoGeometry.cs, SdoPoint.cs and a project file.

Oracle DDL statements:

create table geoinfo (id number(10) not null, geo mdsys.sdo_geometry );
alter table geoinfo add primary key (id);
create sequence geoinfo_seq;

This example inserts a point and a polygon into table geoinfo and after the two inserts it selects table geoinfo. With an OracleDataReader the 2 records in table geoinfo are translated into a List<>.

You have to reference Oracle.DataAccess 2.111.6.20 .

In class SdoPoint I use [OracleObjectMappingAttribute("X")] but in class SdoGeometry I use [OracleObjectMappingAttribute(3)] . Using an integer in this attribute instead of using the column name (string) is faster so maybe you should use an integer in SdoPoint too.



Re: SDO_GEOMETRY & ODP.NET [message #315500 is a reply to message #296419] Mon, 21 April 2008 14:07 Go to previous messageGo to next message
rikidude
Messages: 2
Registered: April 2008
Location: Canada
Junior Member
Thank you for source code!

I have a little question about layer's extents. I know I can use the SDO_ORDINATE_ARRAY, but don't know how using the class.

Thank you very much.
Re: SDO_GEOMETRY & ODP.NET [message #316263 is a reply to message #290544] Thu, 24 April 2008 07:15 Go to previous messageGo to next message
SSKISHORE
Messages: 1
Registered: April 2008
Junior Member
I have downloaded ConsoleApplicationUdt.ZIP file and added reference Oracl.DataAcess.dll(Version 10.2.0.100). So, I am not able to build the solution. I have Oracle10GRel2 on my machine.

Can you give information form where i can get Oracle.DataAccess 2.111.6.20 .? Do i need to install Oracle11?

Thanks,
Kishore
Re: SDO_GEOMETRY & ODP.NET [message #316282 is a reply to message #316263] Thu, 24 April 2008 08:16 Go to previous messageGo to next message
rikidude
Messages: 2
Registered: April 2008
Location: Canada
Junior Member
Kishore,

What is you error code to not be able to compile the applicaion ? I think that you need the last version of ODP.NET (v. 11 http://www.oracle.com/technology/software/tech/windows/odpnet/). If you are not able to compile the application, try to create a new c# application and insert files from your zip.
Re: SDO_GEOMETRY & ODP.NET [message #316347 is a reply to message #316263] Thu, 24 April 2008 13:00 Go to previous messageGo to next message
peterl
Messages: 12
Registered: September 2007
Junior Member
You can use ODP.NET 11 with an Oracle 10 server. I have tested ConsoleApplicationUdt with an Oracle 10.2 database.
Re: SDO_GEOMETRY & ODP.NET [message #347062 is a reply to message #316347] Wed, 10 September 2008 09:52 Go to previous message
coolguy_4838
Messages: 1
Registered: September 2008
Junior Member
i did "ConsoleApplicationUdt.ZIP". it works great. i am using oracle client 11g and i reference to Oracle.DataAccess 2.111.6.20, in my .NET c# application. (OS: windows XP)
server is Oracle 10g.

everything works fine on my local machine and three other machines that have .NET Visual Studio 2005, but i could not get the application to work on a different machine without visual studio.

the failing machine has 11g client and .net framework 3.5

The message i get is below.

*****************************************************************

************** Exception Text **************
System.InvalidOperationException: Custom type mapping for 'dataSource='TRF02PRD' schemaName='MDSYS' typeName='SDO_GEOMETRY'' is not specified or is invalid.
at Oracle.DataAccess.Types.OracleUdt.GetFactory(OracleUdtDescriptor udtDesc)
at Oracle.DataAccess.Client.OracleDataReader.GetCustomObject(Int32 i)
at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
at ProbeMap.Form1.getClusterIDData(Int32 partitionID, Int32 clusterID)
at ProbeMap.Form1.getAllClustersWithinXmeters(Double lat, Double lon)
at ProbeMap.Form1.toolStripMenuItemLoadClustersWithinDistance_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies ************** mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
ProbeMap
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/aKevin/aProjects/ProbeMapping/viewerMap24Mohan/ProbeMap_Ver1.5b.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Map24Control
Assembly Version: 2.2.2.45
Win32 Version: 2.2.2.45
CodeBase: file:///D:/aKevin/aProjects/ProbeMapping/viewerMap24Mohan/Map24Control.DLL
----------------------------------------
Oracle.DataAccess
Assembly Version: 2.111.6.20
Win32 Version: 2.111.6.20
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/Oracle.DataAccess/2.111.6.20__89b483f429c47342/Oracle.DataAccess.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" /> </configuration>

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.



**************************************************************


Is there a way to fix this. It looks like it is not recognizing the user defined type "SDO_GEOMETRY".

Thanks.

Previous Topic: Overlapping polygon and how to determine the points
Next Topic: Spatial index on a table with partitions
Goto Forum:
  


Current Time: Wed Apr 23 11:12:50 CDT 2014

Total time taken to generate the page: 0.15230 seconds