Problem connecting to Oracle with Enterprise Library and System.Data.OracleClient RRS feed

  • Question

  • User1994723947 posted

    Good day everyone.,

    i wonder if you could give me any idea why this is wrong:

    I am using enterprise library 5.0 and i try to connect to an Oracle database.
    This error appears when trying to connect:

    "Activation error occured while trying to get instance of type Database, key "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=;User Id=GL_MOVIL;Password=movil;Integrated Security=no;" "

    My connection string is like this:

    <add name="OraCnx" connectionString="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=;User Id=GL_MOVIL;Password=movil;Integrated Security=no;" providerName="System.Data.OracleClient"/>

    and the line wich breaks the application is:

    Database BD = DatabaseFactory.CreateDatabase(ConfigurationManager.ConnectionStrings["OraCnx"].ToString());

    any idea please?
    Thanks in advance.


    Monday, September 17, 2012 5:05 PM

All replies

  • User269602965 posted

    ="System.Data.OracleClient" should be providerName="Oracle.DataAccess.Client"

    as System.Data.OracleClient has been deprecated.

    Other issues.

    1. It appears Oracle is installed on a workstation with local IP  Is this DHCP issued machine IP??  If so, when your IP address changes, Oracle will be most unhappy.  Best practices as per Oracle installation guide for Windows is when installing Oracle on a workstation to use the Microsoft Loopback Adapter and assign a STATIC IP on different subnet, like to the virtual adapter, then disable all other network adapters temporarily while you install Oracle DB on the loopback adapter.  That way, no matter what your wired or wireless network adapters get for an IP address, Oracle is still running on the Loopback Adapter Static IP address.  In order for the Oracle Database Control application to work in this setting, you can add the STATIC IP and a local DNS name in your WIndows OS HOSTS.INI file, like data.local, for Oracle Database Control web application.

    2. Then after the database is running properly on the workstation and a static IP, you can install the Oracle ODP.NET Client Installation option to get the latest Oracle Data Access dlls installated.

    3. In the connstring try Persist Security Info=True; instead of Integrated Security = no.

    4. If this is a web application and the connection string is in web.config, the string can be accessed by:

    Dim connectionString As String = ConfigurationManager.ConnectionStrings("OraCnx").ConnectionString

    Tuesday, September 18, 2012 9:37 PM
  • User1994723947 posted

    hi, well this oracle is installed on a linux machine. 
    it already have a static ip address.
    Im already able to connect with SqlDeveloper.

    I decided we wont use any Enterprise library for now, so i downloaded the lib package and set up the connectionstring like this:

    "<add name="OraCnx" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=;User Id=GL_MOVIL;Password=movil;Integrated Security=no;" providerName="Oracle.DataAccess.Client"/>"

    then i wrote this piece of code and it throws an Error when creating the OracleConnection instance.
    any ideas please?

            private OracleConnection oraCnx()
                 string strCnx = ConfigurationManager.ConnectionStrings["OraCnx"].ToString();
                 return new OracleConnection(strCnx);
     public DataTable oraDataTable(string oraStoredProcedure)
                OracleConnection cnx = this.oraCnx();
                OracleCommand cmd = new OracleCommand(oraStoredProcedure, cnx);
                cmd.CommandType = CommandType.StoredProcedure;
                DataTable dtResult = new DataTable();
                return dtResult;


    Monday, September 24, 2012 1:41 PM