6 Replies Latest reply: Oct 18, 2007 3:30 PM by 15208 RSS

    OracleConnection.ConnectionString is invalid

    596705
      Hi,

      OracleConnection.ConnectionString is invalid

      am getting the above error while try to get login user unique identifier, using the OracleMembershipProvider method GetUser.

      i used asp.net website configuration tool to configure the website and it is fine,bcos i added role to the oracle database and can create user with the createuserwizard control but to get user, i now get the above result.

      is there something am missing.
        • 1. Re: OracleConnection.ConnectionString is invalid
          15208
          In your application configuration file (typical file name Web.Config), are the following attributes having the same values for both Oracle Membership and Role providers?

          connectionStringName="Oracle"
          applicationName="my_app"/>

          Where "Oracle" is specified in your <connectionStrings> section like below.

          <add name="Oracle" connectionString="User Id=scott;Password=tiger;Data Source=myOracleDB"/>

          Where Data Source myOracleDB is a TNS entry in your tnsnames.ora.

          Can you post your application configuration file? Which most likely has been modified by ASP.NET Configuration.
          • 2. Re: OracleConnection.ConnectionString is invalid
            15208
            The values for the two attributes are just examples. You don't need to use the same names.
            • 3. Re: OracleConnection.ConnectionString is invalid
              342391
              In your application configuration file (typical file
              name Web.Config), are the following attributes having
              the same values for both Oracle Membership and Role
              providers?

              connectionStringName="Oracle"
              applicationName="my_app"/>

              Where "Oracle" is specified in your
              <connectionStrings> section like below.

              <add name="Oracle" connectionString="User
              Id=scott;Password=tiger;Data Source=myOracleDB"/>

              Where Data Source myOracleDB is a TNS entry in your
              tnsnames.ora.
              The format I use for the connection string looks like:

              <add name="Oracle" connectionString="DATA SOURCE=myOracleDB;USER ID=scott;PASSWORD=tiger" providerName="Oracle.DataAccess.Client" />

              Note, the addition of the providerName attribute. It may or may not be relevant to your problem. I haven't tried using the connection string without it.

              Jim
              • 4. Re: OracleConnection.ConnectionString is invalid
                603374
                didnt work for me either. This is my configuration :

                Connectionstring
                <add name="DatabaseUser" connectionString="User Id=username;Password=password;Data Source= tnsvalue" providerName="Oracle.DataAccess.Client" />

                where tnsvalue is TNS entry in tnsnames.ora

                Provider
                <membership defaultProvider="myOracleMemberShipProvider" userIsOnlineTimeWindow="15">
                <providers>
                <clear/>
                <add name="myOracleMemberShipProvider"                     type="Oracle.Web.Security.OracleMembershipProvider"
                     connectionStringName="DatabaseUser"
                     applicationName="tempapp"
                     enablePasswordRetrieval="false"
                     enablePasswordReset="true"
                     requiresQuestionAndAnswer="false"
                     requiresUniqueEmail="true"
                     passwordFormat="Hashed"/>
                </providers>
                </membership>     
                <roleManager enabled="true" defaultProvider="myOracleRoleProvider">
                <providers>
                <clear/>
                <add name="myOracleRoleProvider"
                type="Oracle.Web.Security.OracleRoleProvider"
                connectionStringName="DatabaseUser"
                applicationName="tempapp"/>
                </providers>
                </roleManager>

                I am able to create users using asp.net configuration Tool as well as using asp.net createuserwizard with above configuration.

                but when I tried :
                OracleMembershipProvider user1 = new OracleMembershipProvider();
                DataList1.DataSource = user1.GetUserNameByEmail("existinguser@email.com");
                DataList1.DataBind();

                it throws OracleConnection.ConnectionString is invalid exception.
                what is wrong here??
                Thanks
                • 5. Re: OracleConnection.ConnectionString is invalid
                  603374
                  oopss.. this worked for me.
                  DataList1.DataSource = Membership.GetAllUsers();
                  DataList1.DataBind();

                  which i found on another thread
                  OracleProfileProvider error

                  is that true that it will work for everything else like
                  Roles.GetAllRoles() ??

                  if thats true then, boommm... I will not have to modify any of my code. just modification in web.config.
                  • 6. Re: OracleConnection.ConnectionString is invalid
                    15208
                    That's right. It's provider model-based. As long as you are calling services(Membership, Profile, Personalization, etc.) APIs, you can change or customize a provider as you like in the web.config without rewriting or recompiling your code. You can also extend a provider and use it. Migration to Oracle is easy.