-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to connect with Oracle autonomous database? #59
Comments
Use the TNS Name instead of the partial connection string for the Data Source attribute value. Here's some tutorials with a more complete walk through. Choose the tutorial that best fits your usage scenario. |
Hi ,my connection string is like this but still get the same issue. "ConnectionString": "User Id=admin;Password=FfYSRn7kduSnCR;Data Source=adb<............>oraclecloud.com:1522/<...........>_high.atp.oraclecloud.com" |
You won't be able to use Easy Connect syntax to connect to to ADB since it uses TCPS. Use the TNS name. |
can you please give me an example ? |
You pasted a graphic in your original post that has the TNS Names on the left side. That's an example. I also cover end to end how to connect to ADB in those earlier three links I posted with the TNS name example" myadb_high". |
Hi , I see only dot net core is mention, what about ADB with EF core ? |
Ah, you want to use EF Core with ADB. The configuration scenario is different since EF Core doesn't provide access to the entire ODP.NET API surface itself. There are two sets of files an Oracle ADB connections needs: 1) tnsnames.ora and sqlnet. ora 2) wallet (cwallet.sso) You can place 1) in the current working directory or in the TNS Admin directory location you set. You can place 2) in the wallet directory location you set in either in ODP.NET or sqlnet.ora. For example, if you add the following namespace to your EF Core app: Then add the following two lines of code before invoking any EF Core commands:
Your app will then be able to find 1) and 2) when you set the directory where these files are located. If you do not want to add these two property settings into your code, here's an alternative example that does not require code changes. You can place 1) in the current working directory or web root directory. For 2), you can modify the following sqlnet.ora file setting to where you r wallet is located: |
Hi , I placed in the DbContext constructor and it works. after changing data source to TNS name
Thank you :) ! UpdateTo me it looks like best place to add this is protected override void OnModelCreating(ModelBuilder builder)
{
OracleConfiguration.TnsAdmin = "C:\Users\user1\Downloads\Wallet_DB202002291754";
OracleConfiguration.WalletLocation = "C:\Users\user1\Downloads\Wallet_DB202002291754";
} |
No problem! Glad it worked out. |
I have published the following sample code to demonstrate Oracle EF Core connectivity to Autonomous Database for anyone that stumbles across this thread and needs a sample. |
This link is not working |
@aliaslam63 |
Thanks, I have applied as you quoted above, but I am getting this error now |
ORA-12154 likely means the net service name provided, such as OracleADB_high, can't be resolved to the full connect descriptor in tnsnames.ora. The descriptor usually begins with "(description=...". Did you set the OracleConfiguration.TnsAdmin property to point to the directory that contains your tnsnames.ora file? |
@alexkeh It was the issue with Data source name in the connection string. It is fixed. |
Hi , |
@sumanaik123 Can you turn on ODP.NET tracing to figure out where ODP.NET is looking for its tnsnames.ora file and which one it uses? The trace file should help resolve why you see an ORA-12154. You can turn on tracing using the following settings for managed ODP.NET or ODP.NET Core.
|
Hi , I'm having issue to connect with Oracle autonomous database.
I'm trying to connect to Oracle free autonomous database from EF core 2.2 and i'm getting this erro.
Connection String format
so basically how to connect from these connection strings
Thank you :) !
The text was updated successfully, but these errors were encountered: