Home > database >  Accessing another database user's tables using Entity Framework
Accessing another database user's tables using Entity Framework

Time:08-11

I am trying to access Oracle database using EF Core 6. But the database user given to me doesn't have any database table.

Instead I can see and modify another database user's tables via SQL DEVELOPER.

For example;

my user: my user Other user: IFSAPP

the following query

SELECT * FROM IFSAPP.CUSTOMER;

While returning me a result,

SELECT * FROM CUSTOMER;

does not return any results.

With EF Core "SELECT * FROM IFSAPP.CUSTOMER;" How can I simulate queries with my own user?

CodePudding user response:

Create a synonym in your own schema (that points to table owned by ifsapp):

create synonym customer for ifsapp.customer;

(note that DBA will have to grant you privilege to create synonym).


Or, you can create a view to other user's table, e.g.

create or replace view customer as
  select * from ifsapp.customer;

(as previously, you'll have to be granted the create view privilege).


Or, you could even create a materialized view, but that's probably a little bit too much in this context.

  • Related