0

I made application using DataBase First approach with oracle (in this way https://www.youtube.com/watch?v=tk_EDjTzZCE)

Everything works fine. But if I change userId and password in connectionString (because I want to use another database), then application doesn't work. I have an error: ORA-00942: table or view does not exist so application can connect to database, but can't see tables? enter image description here

For example:

<add name="DbEntities" connectionString="metadata=res://*/DAL.DbModel.csdl|res://*/DAL.DbModel.ssdl|res://*/DAL.DbModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=someapp_first.amazonaws.com:1521/ORCLBK;PASSWORD=apple123;USER ID=FRUIT&quot;" providerName="System.Data.EntityClient" />

<add name="DbEntities" connectionString="metadata=res://*/DAL.DbModel.csdl|res://*/DAL.DbModel.ssdl|res://*/DAL.DbModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=someapp_second.amazonaws.com:1521/ORCL2;PASSWORD=apple123;USER ID=FRUIT&quot;" providerName="System.Data.EntityClient" />

<add name="DbEntities" connectionString="metadata=res://*/DAL.DbModel.csdl|res://*/DAL.DbModel.ssdl|res://*/DAL.DbModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=someapp_third.amazonaws.com:1521/ORCL3;PASSWORD=wege123;USER ID=POTATO&quot;" providerName="System.Data.EntityClient" />

Each database is created on the same server (same strucuture of course). Application will works fine on 1st and 2nd connectionString, but with 3rd won't works. Because there is another UserId/Password.

What's happening?


@EDIT

New Clue. If I put breakpoint on var = data.DB_USER.ToList();

I can see query: enter image description here

    {SELECT 
"Extent1"."ID" AS "ID", 
"Extent1"."FIRST_NAME" AS "FIRST_NAME", 
"Extent1"."LAST_NAME" AS "LAST_NAME", 
"Extent1"."DESCRIPTION" AS "DESCRIPTION", 
"Extent1"."NOTES" AS "NOTES", 
"Extent1"."DEFAULT_CUSTOMER_MODULO" AS "DEFAULT_CUSTOMER_MODULO", 
"Extent1"."VERIFICATION" AS "VERIFICATION", 
"Extent1"."STATUS" AS "STATUS", 
"Extent1"."PIN" AS "PIN"
FROM "FRUIT"."DB_USER" "Extent1"}

Check last line. There is FRUIT instead POTATO. So query is wrong. Why VS using old SCHEMA if I changed connctionstring. I'm using 3rd instead 1st connectionString.

DiPix
  • 5,755
  • 15
  • 61
  • 108
  • Maybe the user you are trying to use does not have permissions to see some of the tables and therefore they appear to be "missing". To verify, connect to the database using the same credentials and try selecting/using the table EF is complaining about. – Pawel Jun 22 '16 at 18:33
  • Everything is fine because I created model again using Entity Wizard (as in youtube tutorial) but i used data from 3rd connectionString and application works fine. But 1st and 2nd doesn't now... – DiPix Jun 22 '16 at 18:37

1 Answers1

0

DiPix

In this situation, i will try to separate out or localize the issue, by creating a separate console application in which i will try accessing just the problematic connection and test if that works fine.

That's the first step after which, we can try to find out what's the issue in conjunction with the main application

Hope this helps,

Praveen Raju

Praveen
  • 1
  • 2
  • Try creating a separate console application that consumes the problematic connection using a connection string. Try the below link http://stackoverflow.com/questions/24828120/how-do-i-set-a-default-connection-string-in-a-console-application – Praveen Jun 22 '16 at 19:02