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.
Related
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 have XML looking like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="profile">
<section name="server1" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=a1a1a1a1a1a1a1a1, Custom=null" />
<section name="server2" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=a1a1a1a1a1a1a1a1, Custom=null" />
<section name="server3" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=a1a1a1a1a1a1a1a1, Custom=null" />
</sectionGroup>
</configSections>
<profile>
<server1>
<add key="server" value="serverName1" />
<add key="check" value="0" />
<add key="user" value="sa" />
<add key="psw" value="secret" />
<add key="show" value="1" />
</server1>
<server2>
<add key="server" value="serverName2" />
<add key="check" value="0" />
<add key="user" value="sa" />
<add key="psw" value="secret" />
<add key="show" value="1" />
</server2>
<server3>
<add key="server" value="serverName3" />
<add key="check" value="0" />
<add key="user" value="sa" />
<add key="psw" value="secret" />
<add key="show" value="1" />
</server3>
</profile>
</configuration>
and I would like to create XSD schema for its validation. I have tried it with online XSD generators like https://www.freeformatter.com/xsd-generator.html with any of 3 types of XSD Design but the problem is that validation will not pass if there is any other number of servers in XML beside 3.
Any help or advice for software or other online XSD generators which can account for this randomness is very much appreciated?
There is no way in XSD (other than XSD 1.1 assertions) to say 'the children of this element must be named "server1", "server2", ... "serverN" in order'. XSD is a bit paternalistic like this: it's not designed to describe any XML you might dream up, it's designed to describe well-designed XML. You should drop the digit and call all the elements "server"; or if the digit serves some purpose (e.g. if it's retained after some server elements are deleted from the XML), then make it an attribute value: <server id="server1".../>
I've always found that XSD.exe does a pretty good job. This validator is also pretty good too. On top of that you could try the XML Tools plugin in Notepad++.
With complex XML documents it's often easier to build them up slowly, so start with a simplified version and then gradually add other parts.
This tutorial and this one are both very good and are definitely worth looking at if you're struggling with xsds.
I suggest you have a look at the tutorials and then maybe rethink what you want and restructure your xml accordingly. An obvious first question might be how do server1, server2, and server3 differ? If they're all the same you want three instances of server; if they're different you probably want to capture that somehow in your xml.
If I install .Net SDK and uses Sample Code, VS says: Cannot resolve symbol 'Configuration' at this line:
var apiContext = Configuration.GetAPIContext();
So, what DLL or namespaces did I missed?
It is a wrapper class around the configuration section.
Please look into \PayPal-NET-SDK-develop\Samples\Source\Utilities\Configuration.cs and create it to suit your configuration.
Don't forget to modify your web.config or app.config
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<!-- PayPal SDK settings -->
<paypal>
<settings>
<add name="mode" value="sandbox" />
<add name="clientId" value="youclientid" />
<add name="clientSecret" value="yoursecret" />
</settings>
</paypal>
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.)
My application is using AppFabric for our distributed caching model in a production web farm of windows web 5 servers. The application is a .net4 c# web application. We are encountering some problems with AppFabric and have some questions regarding the setup of such. The main issue we have is if one of the web 5 servers is restarted, the site on the other servers will also go down for a short period of time with appfabric exceptions like the following appearing in our event logs:
Message: ErrorCode:SubStatus:There is a temporary failure. Please retry later.
ErrorCode:SubStatus:Region referred to does not exist. Use CreateRegion API to fix the error.
We have a cache provider wrapper class that creates the datacachefactory object etc and is used as the intermediatory between the web application and appfabric. This is a singleton class so only one instance of the datacachefactory object is created on the Init of the class.
The second error above I believe I have found the reason for, in our code the region was being created on the Init ie at the very start, but if a node comes out of the cluster that contains the region in its memorary, then the above error is a result. To resolve this issue, the region should be attempted to be created on every request appfabric - but only creating it if it does not exist - does this sound correct?
Regarding the other error, I believe it may be down to the configruation. This is the cluster config xml file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="App1Cache"
secondaries="1">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="App2Cache"
secondaries="1">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="App3Cache"
secondaries="1">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="default">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="724664608" size="1228" leadHost="true" account="SERVER1\user"
cacheHostName="AppFabricCachingService" name="SERVER1"
cachePort="22233" />
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="598646137" size="1228" leadHost="true" account="SERVER2\user"
cacheHostName="AppFabricCachingService" name="SERVER2"
cachePort="22233" />
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="358039700" size="1228" leadHost="true" account="SERVER3\user"
cacheHostName="AppFabricCachingService" name="SERVER3"
cachePort="22233" />
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="929915039" size="1228" leadHost="false" account="SERVER4\user"
cacheHostName="AppFabricCachingService" name="SERVER4"
cachePort="22233" />
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="1752630351" size="1228" leadHost="false" account="SERVER5\user"
cacheHostName="AppFabricCachingService" name="SERVER5"
cachePort="22233" />
</hosts>
<advancedProperties>
<securityProperties>
<authorization>
<allow users="everyone" />
</authorization>
</securityProperties>
</advancedProperties>
</dataCache>
</configuration>
Note: we have multiple we caches set up as we have multiple applications using appfabric, and seeing same issues with them all.
And this is the web.config entry in the application on each of the servers:
<dataCacheClient requestTimeout="15000" channelOpenTimeout="3000" maxConnectionsToServer="1">
<localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000" />
<clientNotification pollInterval="300" maxQueueLength="10000" />
<hosts>
<host name="SERVER1" cachePort="22233" />
<host name="SERVER2" cachePort="22233" />
<host name="SERVER3" cachePort="22233" />
<host name="SERVER4" cachePort="22233" />
<host name="SERVER5" cachePort="22233" />
</hosts>
<transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456" maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000" receiveTimeout="600000" /></dataCacheClient>
Anyone see a problem with the above? As you can see we have 3 lead hosts and 2 secondaries.
Some questions I have following on from this are:
I have read about having a local cache - what is the technical benefit of this? ie. will this give a local copy of the data per node.
What is the best practice regarding ports? Are the above ports correct or could there be conflicts with the same ports being used?
The 3 lead hosts and 2 secondaries, is this a recommended split? Does it mean there are 3 copies of the data?
When we are restarting the servers, we attempt to never restart the lead hosts at the same time.
Thanks for any feedback on this!
We make extensive use of AppFabric caching. You are going to see the
Message: ErrorCode:SubStatus:There is a temporary failure. Please retry later.
fairly often. It's probably best to write yourself a wrapper around AppFabric that automates retries when this error is thrown. You really want to use exponential backoff, but failing that randomizing the retry period may be enough.
The cache configuration in the Web.config file is only used to create the cache factory. It will contact one of the hosts and obtain the cluster configuration from that. The only benefit to listing all hosts in your Web.config is so that if a host is down it can contact another host. Even if you only listed a single host, provided that was present your caching would work fine.
Using a local cache is likely to improve performance if you read objects more frequently than you write them. You're going to have to tune the size of that by experimentation.