| SDO_GEOMETRY & ODP.NET [message #75801] |
Wed, 05 February 2003 04:19  |
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 #290510 is a reply to message #75802 ] |
Sat, 29 December 2007 05:09   |
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   |
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   |
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   |
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   |
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 #316347 is a reply to message #316263 ] |
Thu, 24 April 2008 13:00  |
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.
|
|
|