3

I use a Oracle Data Provider for .NET (Oracle ODP.NET) in a .NET web application and I connect to database with Entity Framework.

When I create the Entity Data Model, in Web.config, VS2010 create a connection string like this:

<add name="eBoardingEntities" connectionString="metadata=res://*/Models.eBoardingModel.csdl|res://*/Models.eBoardingModel.ssdl|res://*/Models.eBoardingModel.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=emobile;PASSWORD=CHECKIN_USER;PERSIST SECURITY INFO=True;USER ID=CHECKIN_USER&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

But when I deploy the application in production environment, I change the data souce in "DATA SOURCE=emobileProduction".

The application in production environment does not work. The error application is : "Table or view not found". The application is not connected to DB.

To make it work I need to cancel the Entity Data Model and regenerate this with a new connection to production database.

Any help to not regenerate Entity Data Model, without having to reset connection to database of production?

3
  • I don't understand what you are asking. Is your production data model different than the dev model and you want to generate an Entity Model from the production model? Commented Dec 4, 2012 at 13:13
  • No, i have the same database in dev environment and production environment. When i generate the Entity Model from different database i obtain the same result. My question is: when i generate the Entity Model, there is any place where Visual Studio insert the name of database (or DATA SOURCE name)???? Because if i generate the model from dev database, when i deploy the application in production environment, at first query on database i obtain the exception "Table or view does not exist". Tanks. Commented Dec 5, 2012 at 8:10
  • Also the connection string in Web.config is the same. Commented Dec 5, 2012 at 8:11

2 Answers 2

2

I solved!!!

In oracle, the name of user is the name of the schema.

In production i had the user CHECKIN whereas in develop environment the user was CHECKIN_USER.

For this reason, the schemes have different name and the Entity Model generate in development environment is different from production.

Tanks everybody!!!

Bye.

Sign up to request clarification or add additional context in comments.

1 Comment

I had the same situation. I'm able to switch back and forth between environments by opening the edmx file into an XML editor and find/replace the Schema attribute values, then re-generate the Entities. Ugly, but works.
0

The error "Table or view not found" can mean two things:

  • The table or view really isn't in the database. I suspect this isn't the case for you.
  • The user that is connecting to the database doesn't have permissions to use the table. If the user hasn't been granted SELECT privilege on the table, either direct or through a role, the user won't be able to select from it. This is a common oversight and I suggest you check this one.

The easiest method to check it is to connect to the database via a tool like PL/SQL Developer og SQL Navigator as the user that you are using and try to select from the table. You can also connect to the database as a user with lots of privileges and query the system views.

The connection string for EF seems OK to me for the production. You set it in the web.config and the most important parts are the data source and the user specifications.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.