Page 1 of 1

Switch from DirectMode to OracleClient Mode

Posted: Wed 15 Jun 2011 08:15
by rednose84
Hy @all!

I want to change the connectionStirng in my web.config from a direkt one to a connString which is using the installed oracleclient. (its needed for connection to a dataguard managed database for productive system)

So i want to change this types once with direktmode and sometimes the clientmode. If I specify the connectionstring to use oracleclient, i get an connection, but the tables / views are not found. (perhaps the tables are still in database).

Only if I renew the *.edml (with non direct mode) its working fine. But I don't want do generate the Model everytime. In this case I can't change easily the connString to DirectMode. I get also some errors.

Pls some help.

kind regards

Posted: Wed 15 Jun 2011 12:34
by AndreyR
I have performed a test and succeeded in switching between two (OCI and Direct) connection strings using the following code:

Code: Select all

      using(var context = new AndreyrEntities()) {
        var q = from d in context.DetailTables select d;
        Console.WriteLine(q.Count());
      }
      using(var context = new AndreyrEntities("name=OCI")) {
        var q = from d in context.DetailTables select d;
        Console.WriteLine(q.Count());
      }
The connection strings were pointing to the same server.
I recommend you to check that the user name and password are the same for the Direct and OCI connections, and that the server name in tnsnames.ora is correct and points to the server that was used in the Direct connection.