2

In my controller I have a JsonResult function called by a Javascript that's called by a button in View. this will save input from textbox to database table. But in it's first line of code (connecting to Oracle), it's alread having an error:

using (var con = new OracleConnection(ConfigurationManager.ConnectionStrings["DBEntities"].ConnectionString))

An exception of type 'System.ArgumentException' occurred in Oracle.DataAccess.dll but was not handled in user code

Additional information: 'metadata' is an invalid connection string attribute

Here's my auto-generated connectionString in web.config:

<add name="DBEntities" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=DBDEV;PASSWORD=db;PERSIST SECURITY INFO=True;USER ID=db&quot;" providerName="System.Data.EntityClient" />

What seems to be the problem? And how do I fix it?

4
  • Possible duplicate of Oracle ODP.Net With Entity Framework 6 - Entity framework database compatible provider could not be found Commented Aug 5, 2016 at 3:45
  • I believe the link you posted is not the same with mine. They don't even mention there the metadata connectionstring Commented Aug 5, 2016 at 6:10
  • Not exact duplicate but those are the steps you need to follow to connect with Oracle DB in EF code first approach. It talks about how connection string should exactly look like when using Oracle DB with EF. Commented Aug 5, 2016 at 6:14
  • I tried the solution but it didn't fix my problem. Same System.ArgumentException error Commented Aug 5, 2016 at 8:28

1 Answer 1

1

I had this same issue and resolved it using this post: Keyword Not Supported: Metadata

The trick is because it is Oracle you need to change your string to something like this:

<add name="DBEntities" connectionString="DATA SOURCE=DBDEV;PASSWORD=db;PERSIST SECURITY INFO=True;USER ID=db&quot;" providerName="Oracle.ManagedDataAccess.Client" />

I know this post is super old, but hopefully this helps someone else.

Sign up to request clarification or add additional context in comments.

1 Comment

Lose the end quote. It's only the silly EF which uses it. <add name="DBEntities" connectionString="DATA SOURCE=DBDEV;PASSWORD=db;PERSIST SECURITY INFO=True;USER ID=userId" providerName="Oracle.ManagedDataAccess.Client" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.