Using EFCore in Azure: ConnectionString? Prerequisites?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
cbiegner
Posts: 8
Joined: Thu 24 Nov 2016 15:52

Using EFCore in Azure: ConnectionString? Prerequisites?

Post by cbiegner » Thu 17 May 2018 13:26

Hi.

I built a small Service that connects to our on Premise Oracle Database, gets some data vie EF and return this data via REST/JSON.

All works fine when run locally or in our test-Environment (which is in our local network), but published on Azure the DBServer is not found although we got the local Network and the azure network connected.

The ConnectionString so far is quite usual:

Code: Select all

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                if (!optionsBuilder.Options.Extensions.OfType<RelationalOptionsExtension>().Any(ext => !string.IsNullOrEmpty(ext.ConnectionString) || ext.Connection != null))
                  optionsBuilder.UseOracle(@"User Id=MYDBUSER;Password=MYPASSWORD;Server=MYDBSERVER;Direct=True;Sid=MYDBSERVER;Persist Security Info=True;License Key=QuiteLongUnreadableString");
            }
            CustomizeConfiguration(ref optionsBuilder);
            base.OnConfiguring(optionsBuilder);
        }
What I get is an 'ORA-12545: Connect failed because target host or object does not exist'

So MYDBSERVER is not found, I guess. Do I need a tsnames.ora?

Regards,
Christoph

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Using EFCore in Azure: ConnectionString? Prerequisites?

Post by Shalex » Tue 22 May 2018 09:48

cbiegner wrote: Thu 17 May 2018 13:26What I get is an 'ORA-12545: Connect failed because target host or object does not exist'

So MYDBSERVER is not found, I guess. Do I need a tsnames.ora?
tnsnames.ora is not used in the Direct mode.

Follow general recommendations concerning this error:
1) ping MYDBSERVER, is it available? Try using its IP address instead of DNS name
2) make sure that listener at Oracle side is running
3) try connecting to your Oracle Server with other tool
etc.

Post Reply