Rob Kraft's Software Development Blog

Software Development Insights

Error ORA-1153 using Oracle.ManagedDataAccess.DLL to connect

Posted by robkraft on March 17, 2014

We switched from using Oracle.DataAccess.DLL to Oracle.ManagedDataAccess.DLL in our .Net App.  The code change took minutes, but all the connection string  changes took me a few hours to resolve.  The last error I kept receiving when I tried to connect to Oracle was ORA-1153.  Specifically I had the following values in the exception:

  • HResult: -2147467259
  • Message: Oracle error ORA-1153 encountered
  • Source : Oracle Data Provider for .NET, Managed Driver

This error occurred when the code tried to open the connection

  • _cnOra.Open();

The error occurred because I was missing the CONNECT_DATA value from the descriptor in my datasource of my application .config file.  I had this value:

<dataSource alias=”dev” descriptor=”(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myServerName)(PORT=1521)) )”/>

when I should have had this value:

<dataSource alias=”dev” descriptor=”(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myServerName)(PORT=1521)) (CONNECT_DATA = (SERVICE_NAME = dev)))”/>

 

2 Responses to “Error ORA-1153 using Oracle.ManagedDataAccess.DLL to connect”

  1. ck said

    Think you could show a bit more of your config file? Not sure where the <datasource element would come into play. Currently getting this error myself.

    http://stackoverflow.com/questions/25569702/odp-net-error-when-trying-to-open-connection-ora-1153-encountered

    • robkraft said

      Sure. The main config file has:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      <configSections>
      <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
      </configSections>
      <oracle.manageddataaccess.client configSource="bin\_config\OracleSettings.config" />
      </configuration>

      Then the details are in our OracleSetting.config

      <oracle.manageddataaccess.client>
      <version number="*">
      <dataSources>
      <dataSource alias="dev" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=yourservername)(PORT=1521)) (CONNECT_DATA = (SERVICE_NAME = dev)))"/>
      </dataSources>
      </version>
      </oracle.manageddataaccess.client>

Leave a comment