I am attempting to fill a dataset from an oracle table. I am getting the following error:
SDO_GEOMETRY is not specified or is invalid
When I attempt to fill a dataset from a table which contains a geometry column:
da.Fill(ds, "Default");
I have added a reference to NetSdoGeometry
And also included it:
using NetSdoGeometry;
But I still receive the same error.
I also tried adding the type to the config as follows:
<oracle.dataaccess.client>
<settings>
<add name="sdogeometry" value="udtMapping factoryName='NetSdoGeometry.sdogeometry, NetSdoGeometry, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' typeName='SDO_GEOMETRY' schemaName='MDSYS'"/>
</settings>
</oracle.dataaccess.client>
But that did not help. What am I missing?
had similar problem.
We used NetTopologySuit insted of NetSdoGeomtry and included:
<oracle.dataaccess.client>
<settings>
<add name="SdoGeometry" value="udtMapping factoryName='NetTopologySuite.IO.Sdo.SdoGeometry, NetTopologySuite.IO.Oracle' typeName='SDO_GEOMETRY' schemaName='MDSYS'" />
<add name="SdoElemInfoArray" value="udtMapping factoryName='NetTopologySuite.IO.Sdo.SdoGeometry+ElemArrayFactory, NetTopologySuite.IO.Oracle' typeName='SDO_ELEM_INFO_ARRAY' schemaName='MDSYS'" />
<add name="SdoOrdinateArray" value="udtMapping factoryName='NetTopologySuite.IO.Sdo.SdoGeometry+OrdinatesArrayFactory, NetTopologySuite.IO.Oracle' typeName='SDO_ORDINATE_ARRAY' schemaName='MDSYS'" />
<add name="SdoPoint" value="udtMapping factoryName='NetTopologySuite.IO.Sdo.SdoPoint, NetTopologySuite.IO.Oracle' typeName='SDO_POINT_TYPE' schemaName='MDSYS'" />
</setting>
</oracle.dataaccess.client>
(this is taken from NullReferenceException in Oracle.DataAccess for empty SDO_GEOMETRY Although this is about another problem, udtMapping is correct and worked for us.)
Related
I am getting a runtime System.TypeInitializationException that points to the custom edmMappings that have been inserted into the web.config:
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<!--added the following number mapping to eliminate mapping to short error-->
<edmNumberMapping>
<add NETType="bool" MinPrecision="1" MaxPrecision="1" DBType="Number"/>
<add NETType="int16" MinPrecision="2" MaxPrecision="5" DBType="Number"/>
</edmNumberMapping>
</edmMappings>
<dataSources>
<!--my sources-->
</dataSources>
<settings>
<!--my settings-->
</settings>
</version>
</oracle.manageddataaccess.client>
Error is:
The element 'edmMappings' has invalid child element 'edmNumberMapping'
What is weird is that someone that had worked on this app prior can get around this runtime error but I cannot. What is going wrong here?
Entity Framework 6.1.3
Oracle.ManagedDataAccess.EntityFramework 12.1.24
Thanks!
Web.config is like that.
<configSections>
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false"/>
</configSections>
<connectionStrings configBuilders="Environment">
<add name="ConnectionString" connectionString="ConnectionString" providerName="System.Data.OracleClient" />
<add name="OracleDbContex" providerName="Oracle.ManagedDataAccess.Client" connectionString="OracleDbContex" />
</connectionStrings>
<configBuilders>
<builders>
<add name="Environment" mode="Greedy" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
</builders>
</configBuilders>
I have two connection string one of them is normal Ado.net connection. Another one is the oracle entity. But problem is that when program start and connection strings change from environment variables, ado.net connections work normally but dbcontex give this error.
System.InvalidOperationException: 'The connection string 'OracleDbContex' in the application's configuration file does not contain the required providerName attribute."'
If I don't use ConfigurationBuilders, two connection working normally. I need to get connection strings from environment variables. What should I do?
I found solution. Its about builder mode. I changed greedy to strict and it fixed.
When using Strict mode the configuration values are looked up first and every entry found is updated with override value (if present). Meaning the original connectionString XML node is kept with all its attributes, including the attribute providerName.
We need to setup following properties in config file to enable native encryption of oracle
SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT = (MD5)
SQLNET.ENCRYPTION_TYPES_CLIENT = (AES256)
SQLNET.ENCRYPTION_CLIENT = required
SQLNET.CRYPTO_CHECKSUM_CLIENT = required
Below is the link where I found out it can be done through config file (search for the above properties in link page e.g. ENCRYPTION_CLIENT)
https://docs.oracle.com/cd/E63277_01/win.121/e63268/InstallManagedConfig.htm#ODPNT8164
I was not able to find any good example till now.
Can anyone provide an example or link to see how to enable encryption from config file.
In Configuration section add the below lines.
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
Connection String:
<add key="ConnectionString" value="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server name)(PORT=XXXX))(CONNECT_DATA=(SERVICE_NAME=service name)));" />
Add the below section under runtime section:
<oracle.manageddataaccess.client>
<version number="*">
<settings>
<setting name="sqlnet.encryption_types_client" value="aes256" />
<setting name="sqlnet.encryption_client" value="required" />
</settings>
</version>
</oracle.manageddataaccess.client>
I'm performing a migration of database, SQL Server to Oracle, in a C# application. The application mentioned, is using Entity Framework to access the database.
In this database there's a procedure that returns a "ComplexType", I researched and found that Oracle does not understand the "ComplexType" and I need to perform the mapping of the output parameter in web.config, then:
<oracle.manageddataaccess.client>
<version number="*">
<implicitRefCursor>
<storedProcedure schema="ALERTA_MPLUS" name="PR_CONSULTA_DADOS_ROBO">
<refCursor name="CV_1">
<bindInfo mode="Output" />
<metadata columnOrdinal="0" columnName="Broker" baseColumnName="Broker" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="Varchar2" providerType="Varchar2" columnSize="50" />
<metadata columnOrdinal="1" columnName="Companhia" baseColumnName="Companhia" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="Varchar2" providerType="Varchar2" columnSize="100" />
<metadata columnOrdinal="2" columnName="Metrica" baseColumnName="Metrica" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="Varchar2" providerType="Varchar2" columnSize="50" />
<metadata columnOrdinal="3" columnName="Q1" baseColumnName="Q1" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="NVarchar2" providerType="NVarchar2" columnSize="50" />
<metadata columnOrdinal="4" columnName="Q2" baseColumnName="Q2" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="NVarchar2" providerType="NVarchar2" columnSize="50" />
<metadata columnOrdinal="5" columnName="Q3" baseColumnName="Q3" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="NVarchar2" providerType="NVarchar2" columnSize="50" />
<metadata columnOrdinal="6" columnName="Q4" baseColumnName="Q4" baseSchemaName="ALERTA_MPLUS" baseTableName="tt_Resultado_Final" nativeDataType="NVarchar2" providerType="NVarchar2" columnSize="50" />
</refCursor>
</storedProcedure>
</implicitRefCursor>
</version>
</oracle.manageddataaccess.client>
This mapping worked perfectly in the development environment, but when I passed the application for approval gave the following error:
I've tried some solutions but none was successful:
ODAC installed on the server approval;
Searching, I found the Oracle documentation that indicates the mapping that way:
<oracle.dataaccess.client>
<settings>
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursor.CV_1" value="implicitRefCursor bindinfo='mode=Output'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.0" value="implicitRefCursor metadata='ColumnName=Broker;BaseColumnName=Broker;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.1" value="implicitRefCursor metadata='ColumnName=Companhia;BaseColumnName=Companhia;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.2" value="implicitRefCursor metadata='ColumnName=Metrica;BaseColumnName=Metrica;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.3" value="implicitRefCursor metadata='ColumnName=Q1;BaseColumnName=Q1;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=NVarchar2;ProviderType=NVarchar2'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.4" value="implicitRefCursor metadata='ColumnName=Q2;BaseColumnName=Q2;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=NVarchar2;ProviderType=NVarchar2'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.5" value="implicitRefCursor metadata='ColumnName=Q3;BaseColumnName=Q3;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=NVarchar2;ProviderType=NVarchar2'" />
<add name="ALERTA_MPLUS.PR_CONSULTA_DADOS_ROBO.RefCursorMetaData.CV_1.Column.6" value="implicitRefCursor metadata='ColumnName=Q4;BaseColumnName=Q4;BaseSchemaName=ALERTA_MPLUS;BaseTableName=tt_Resultado_Final;NATIVEDATATYPE=NVarchar2;ProviderType=NVarchar2'" />
</settings>
</oracle.dataaccess.client>
This is code return the following error (in all environments):
ORA-06550: line 1, colunm 8: PLS-00306:
wrong number or types of arguments in call to
'PR_CONSULTA_DADOS_ROBO' ORA-06550: line 1, colunm 8: PL/SQL:
Statement ignored;
I published the application on another machine (another developer) and also worked;
Some information that I think are necessary:
Visual Studio 2013;
Oracle.DataAcess.dll version 4.121.1.0;
Oracle.ManagedDataAccess.dll version 4.121.1.0;
ISS 7.0;
Pool - Enable 32-bit Applications true;
If you can help me...
Very thanks in advance!
After many trials and errors managed to solve. I do not know if it is the best solution but worked.
In machine.config exists a definition of <oracle.manageddataaccess.client>:
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
So I added this declaration in web.config and it worked perfectly.
I had the same issue and this showed me the way to a solution.
The cause of the issue was that I had installed the OracleManagedDataAccessClient through NUGET but someone else had done a native install of the client. When the client was installed, it created an entry in the Machine.Config. When NUGET installed it created an entry in the Web.config. When trying to execute, I received an error that the section for:
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
Already existed. I commented it out and my service worked but Oracle would fail with the error:
"PLS-00306: wrong number or types of arguments in call"
When the client was installed it was an earlier version of Oracle so the entry in the Machine.config was:
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.**1**.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
Since I commented the entry in web.config, the application used the machine.config entry which did not match the actual version.
I modified the entry in the machine.config to match the web.config and everything now works.
Using .net 3.5 and Enterprise library 5.0.
From my research, I found a similar issue here:
Activation error occured while trying to get instance of type ICacheManager, key "Cache Manager" *** this solution did not fix my issue.
I can't seem to figure it out, my config should be set up correctly, but keep getting the exception? Anyone have similar issues?
I made the suggestion to add cacheManager and reference when I call the cache manager:
using Microsoft.Practices.EnterpriseLibrary.Caching;
using Microsoft.Practices.EnterpriseLibrary.Caching.Expirations;
.....
....
ICacheManager cm = CacheFactory.GetCacheManager("TrackingCacheManager");
The App.config:
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<cachingConfiguration defaultCacheManager="TrackingCacheManager">
<cacheManagers>
<add name="TrackingCacheManager" type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
expirationPollFrequencyInSeconds="120" maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10" backingStoreName="NullBackingStore" />
</cacheManagers>
<backingStores>
<add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="NullBackingStore" />
</backingStores>
</cachingConfiguration>
<dataConfiguration defaultDatabase="ConnectionString" />
<connectionStrings>
<add name="ConnectionString" connectionString="server=AFS7BCBRNGQ5O0\DEVELOPMENT;database=EITC_RTS;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
My references:
My guess is that you've setup this configuration in an App.config for your Domain project. But your main project has it's own config file which this configuration must be copied into.
So for example, if your main project was a webapp, then it would have a web.config. The caching configuration you have added to the App.config of the Domain project is not used at runtime. The configuration being used is from main project's config, in this example the web.config.
Copy your Caching configuration from the Domain App.Config to the main config file and it will work.
I have done silly mistake, but after read above, understand the issue. This is my vb.net code which give me the above error.
Imports System.Collections
'Imports System.Configuration
Public Class DatabaseLogic
Public ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("db").ToString()
Public Function ServerDataMagic(StoredProcedure As String, PDMdata As Hashtable) As DataSet
Dim db As Database = DatabaseFactory.CreateDatabase(ConnectionString ) 'Here I am getting error.
Using cmd As DbCommand = db.GetStoredProcCommand(StoredProcedure)
Try
db.DiscoverParameters(cmd)
Catch discover_ex As Exception
End Try
and in web.config entry is
<add name="db" connectionString="Database=Dbname;Server=SERVER;uid=sa;pwd=sa#1234" providerName="System.Data.SqlClient" />
After read just get the issue is CreateDatabase method wants a config entry key as a string and I was given the exact connection string via config entry access. This is my updated code.
Dim db As Database = DatabaseFactory.CreateDatabase("db") 'Here I changed the config entry key
I was post to somebody help.