Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to connect to the human_resources schemas in 12c?

9a8s7d6f5g4h3j2k1lJan 28 2014 — edited Jan 29 2014

Hi, i didnt have hr user, i didnt have schemas, so i download the example schemas from oracle downloads. Installed them to F:\app\product\12.1.0\dbhome_1\demo\schema\human_resources

Here goes the question, do i have now HR user? or must create the new one? And, if i must create new one, how can i grant him privilege to acces those schemas

In SQL Developer for user SYSTEM, show me other tables that i dont need right now. So how can i solve this problem?
Please write commands for SQL plus because i am new in this. Thank you.

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

PL/SQL Release 12.1.0.1.0 - Production

"CORE 12.1.0.1.0 Production"

TNS for 64-bit Windows: Version 12.1.0.1.0 - Production

NLSRTL Version 12.1.0.1.0 - Production

This post has been answered by Richard Harrison . on Jan 29 2014
Jump to Answer

Comments

Alex Keh-Oracle

The ambiguity appears that you have the DevArt EF Core provider installed and setup with your app along with Oracle EF Core. Both providers implement UseOracle() and EF Core doesn't know which one you actually want to use.

user5716448

Thanks for reply - removing devart worked in resolving ambiguity and solution builds o.k.

However, get error message below when tried to run it.

System.ArgumentException: 'AddDbContext was called with configuration, but the context type 'RazorPagesMultipleContext' only declares a parameterless constructor. This means that the configuration passed to AddDbContext will never be used. If configuration is passed to AddDbContext, then 'RazorPagesMultipleContext' should declare a constructor that accepts a DbContextOptions<RazorPagesMultipleContext> and must pass it to the base constructor for DbContext.'

  services.AddDbContext<RazorPagesMultipleContext>(options =>

                 //  options.UseSqlServer(Configuration.GetConnectionString("RazorPagesMultipleContext")));

                   options.UseOracle(Configuration.GetConnectionString("RazorPagesMultipleContext")));

How can we call the context successfully or how should we define below in context

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

        {

            optionsBuilder.UseOracle(@"User Id = <userid>; Password = <pwd>; Data Source = <server>:1521/<SID>;");

        }

Thanks

Alex Keh-Oracle
user5716448

Thanks.

Now the solution builds successfully.

However, web page doesn't launch anymore.

works with local sqlserver however when try and use oracle it is no longer launching

called from startup.cs - only diff with oracle one is bits in bold

Any thought as to why not working - anything else missing to get this to work with oracle.

based on https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/?view=aspnetcore-2.2 and just trying to use oracle rather than local sql server database

            services.AddDbContext<RazorPagesMultipleContext>(options =>

                 //  options.UseSqlServer(Configuration.GetConnectionString("RazorPagesMultipleContext")));

                   options.UseOracle(Configuration.GetConnectionString("RazorPagesMultipleContext")));

context definition below.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using Oracle.EntityFrameworkCore;

using Microsoft.EntityFrameworkCore;

namespace RazorPagesMultiple.Models

{

    public class RazorPagesMultipleContext : DbContext

    {

         public RazorPagesMultipleContext (DbContextOptions<RazorPagesMultipleContext> options)

              : base(options)

          {

           }

        public DbSet<RazorPagesMultiple.Models.Multiple> Multiple { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

        {

            optionsBuilder.UseOracle(@"User Id = <uname>; Password = <pwd>; Data Source = <server>:1521/<SID>;");

        }

    }

}

user5716448

Getting message below now despite fact can tnsping <SID> from command prompt on my pc

Anything else need to set up to get it working with oracle

An unhandled exception occurred while processing the request.

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

OracleInternal.Network.AddressResolution..ctor(string TNSAlias, string instanceName)

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

OracleInternal.ConnectionPool.PoolManager<PM, CP, PR>.Get(ConnectionString csWithDiffOrNewPwd, bool bGetForApp, OracleConnection connRefForCriteria, string affinityInstanceName, bool bForceMatch)

user5716448

Already have a TNS_ADMIN environment variable on pc but thinking something else must be needed to get oracle working with ef core.

user5716448

Managed to get further

Needed to use

optionsBuilder.UseOracle(@"User Id = <uname>; Password = <pwd>; Data Source = <SID>;");

However get message table or view does not exist.

On database table name is all upper case but ef core generating sql below in mixed case.

believe problem is that ef core is generating sql with quotation marks - how can this be stopped to allow this to work?

   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)

Microsoft.EntityFrameworkCore.Database.Command:Error: Failed executing DbCommand (137ms) [Parameters=[], CommandType='Text', CommandTimeout='0']

SELECT "m"."MULT_MULTIPLE_CODE", "m"."MULT_ANMW_MULTIPLE_CODE", "m"."MULT_AUTH_REQUIRED", "m"."MULT_JMW_MULTIPLE_TYPE_CODE", "m"."MULT_LINK_MULTIPLE_CODE", "m"."MULT_NAME", "m"."MULT_PROM_AUTH_REQUIRED", "m"."MULT_SELECTED_MULTIPLE"

FROM "Multiple" "m"

user5716448

Will start a new thread as looks like have got past first set of issues and now just looking to how can avoid ef core generating quoting which is causing table or view does not exist error

User_AVGNE

I've been trying to take advantage of Oracle.EntityFrameworkCore v3.19 provider for .NetCore.
I've followed Oracle's tutorial in terms of testing these features together. With just a couple classes, a dbSet of those classes. And in the main function I try to add a instance of a class to the DbSet, and try to SaveChanges().
I've also created the tables for those couple classes in my Database schema.
But everytime i run it get an Exception (at the db.SaveChanges(); line):
OracleException: ORA-06550: line 13, column 14: PL/SQL: ORA-00942: table or view does not exist ORA-06550: line 13, column 1: PL/SQL: SQL Statement ignored
Please let me know if there's something i can try to move on from this.

Alex Keh-Oracle

I would recommend turning on tracing to see what SQL is being executed when the error occurs. That will tell you the name of the table or view EF Core is trying to use.

1 - 10
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 26 2014
Added on Jan 28 2014
42 comments
18,636 views