I am trying to make the default ASP.NET MVC application use a remote Oracle database. I have set up the oracle client and can access the remote database from Server Explorer.
I tried changing the connection string from
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
to
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=orcl;Persist Security Info=True;User ID=username;Password=mypassword;Unicode=True"
providerName="Oracle.DataAccess.Client" />
</connectionStrings>
I used the connection string from Server Explorer > Data Connection > orcl.instance
When creating a new user, I am getting the following error in AccountModels.cs
An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString
Any idea what am I missing here?
EDIT:
Looks like the following snippet in AccountModels.cs uses System.Data.SqlClient.SqlConnection. How can I use the ODP version.
public class AccountMembershipService : IMembershipService
{
private readonly MembershipProvider _provider;
...
}
You have to use ODP.NET API instead of
SqlClientprovider. TheSystem.Data.SqlClientclasses are for Microsoft SQL server database only.EDIT:
Oracle article : Oracle Providers for ASP.NET Installation