Scaffold Oracle Database

tinac99 1 Reputation point
2021-09-01T18:17:11.583+00:00

Hi,

I'm trying to scaffold a DB2 database accessible in Oracle SQL Developer. I already installed the Oracle.EntityFrameworkCore

Here are the specs on connection popup screen:

Name: PSABC
Database Type : DB2
Username: Khan
Password: MyNameIs

Platform: UDB
Hostname: dss
Port: 5000
Database: $db1:useJDBC4ColumnNameAndLabelSemantics=No;

I formed the connection string:
1)
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dss)(PORT=5000))(CONNECT_DATA=(SERVICE_NAME=$db1)));Persist Security Info=True;user id=Khan;password=MyNameIs;

Scaffold-DbContext "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dss)(PORT=5000))(CONNECT_DATA=(SERVICE_NAME=$db1)));Persist Security Info=True;user id=Khan;password=MyNameIs;" Oracle.EntityFrameworkCore -OutputDir Models -Tables PS_PERSONAL_DATA,PS_NAMES -Context PS75 -force

Error : ORA-12537: Network Session: End of file

2)
Scaffold-DbContext "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dss)(PORT=5000))(CONNECT_DATA=(SERVICE_NAME=$db1:useJDBC4ColumnNameAndLabelSemantics=No;)));Persist Security Info=True;user id=Khan;password=MyNameIs;" Oracle.EntityFrameworkCore -OutputDir Models -Tables PS_PERSONAL_DATA,PS_NAMES -Context PS75 -force

Error: Connection string is not well-formed
* if i remove the ";" in the SERVICE_NAME, it gives error ORA-00303: Network Library: Name-Value syntax error
Also, removing the ";" in the Oracle connection popup generates an error

3) Scaffold-DbContext "Data Source=SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dss)(PORT=5000))(CONNECT_DATA=(SERVICE_NAME=$db1:useJDBC4ColumnNameAndLabelSemantics=No)));Persist Security Info=True;user id=Khan;password=MyNameIs;" Oracle.EntityFrameworkCore -OutputDir Models -Tables PS_PERSONAL_DATA,PS_NAMES -Context PS75 -force

Error: ORA-12154: TNS:could not resolve the connect identifier specified

What am i missing?

Thanks,

tinac99

Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-09-01T21:58:15.77+00:00

    I would recommend using the following syntax rather than TNSNames format.

    Scaffold-DbContext "Data Source=SERVER_NAME_GOES_HERE;Persist Security Info=True;Enlist=false;Pooling=true;Statement Cache Size=10;User ID=IDENTIFIER_GOES_HERE;Password=PASSWORD_GOES_HERE;" -Provider Oracle.EntityFrameworkCore -OutputDir Models -Context MobileContext -v -f -project SomeProject -startupproject SomeProject -ContextDir Contexts -t "ADJUDICATOR_PROGRAM_CODES","CLAIMANT_ADDRESS_CHANGES"

    I've been doing this using a tool and works just fine.

    128356-figure11.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.