user1239944
user1239944

Reputation: 53

Change connection string .NET Oracle error

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?

Upvotes: 3

Views: 621

Answers (2)

user1239944
user1239944

Reputation: 53

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.

Upvotes: 2

GTG
GTG

Reputation: 4954

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.

Upvotes: 0

Related Questions