Scaffold-DbContext Can't find a database from tnsnames.ora? — oracle-tech

    Forum Stats

  • 3,715,654 Users
  • 2,242,820 Discussions
  • 7,845,479 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Scaffold-DbContext Can't find a database from tnsnames.ora?

Tridus
Tridus Member Posts: 594 Silver Badge
edited December 2019 in ODP.NET

Hi. I'm just getting into Core now, and one of the first things I'm trying to do is reverse engineer a database for Entity Framework Core. All my hosts are in a tnsnames.ora file, so I'm trying to set OracleConfiguration.TnsAdmin.

This works fine when running the application itself, and I can connect no problem. But Scaffold-DbContext comes back with ORA-12154: TNS:could not resolve the connect identifier specified, suggesting to me that it doesn't know where to look. I haven't been able to find anything on how to tell it where to find tnsnames.ora.

Any tips?

Thanks!

Best Answer

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,751 Employee
    edited December 2019 Accepted Answer

    You can Easy Connect, Easy Connect+ (ODP.NET 19c), or set Data Source equal to the entire connect descriptor (i.e. (DESCRIPTION = (ADDRESS...)) if you don't want to use a tnsnames.ora file.

    If you'd like to use tnsnames.ora, then put the tnsnames.ora file in the same directory as Oracle.ManagedDataAccess.dll or the current working directory from where you care calling Scaffold-DbContext.

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,751 Employee
    edited December 2019 Accepted Answer

    You can Easy Connect, Easy Connect+ (ODP.NET 19c), or set Data Source equal to the entire connect descriptor (i.e. (DESCRIPTION = (ADDRESS...)) if you don't want to use a tnsnames.ora file.

    If you'd like to use tnsnames.ora, then put the tnsnames.ora file in the same directory as Oracle.ManagedDataAccess.dll or the current working directory from where you care calling Scaffold-DbContext.

  • Tridus
    Tridus Member Posts: 594 Silver Badge
    edited December 2019

    That worked, thanks!

Sign In or Register to comment.