Page 1 of 1

Using EFCore in Azure: ConnectionString? Prerequisites?

Posted: Thu 17 May 2018 13:26
by cbiegner
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

Re: Using EFCore in Azure: ConnectionString? Prerequisites?

Posted: Tue 22 May 2018 09:48
by Shalex
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.