Implementing the membership mechanism in Oracle

Source: Internet
Author: User

Many of my friends said that the membership mechanism cannot be implemented on Oracle,

But unfortunately,

This blog post aims to show these friends how to implement the membership mechanism on the Oracle database.

In the previous blog, I introduced a lot about how to use C # To operate Oracle databases,

It also involves a lot of information about how to control the Oracle database in Visual Studio,

I also wrote a lot of blog posts about membership and roles and profile,

However, the introduction is based on the SQL Server database,

(If you are not familiar with how to implement membership on SQL Server, I have a lot of blog posts on this part,

You can read the blog posts that implement the membership mechanism on SQL Server first, and then read how to read this blog post)

But this blog post will introduce how to use the membership mechanism on the Oracle database,

First of all, there is still a lot of preparation to use the membership mechanism on the Oracle database,

Let's look at the environment first. Let's look at my environment directly,

My environment is Windows 7 (server version is recommended), Visual Studio team System 2008,

Oracle 11gr1, and then the latest version of ODT. NET is installed.

Http://www.oracle.com/technology/global/cn/software/tech/dotnet/odt_index.html

After ODT. NET is installed, you can directly establish a connection with the Oracle database in Visual Studio,

You can directly establish a connection with Oracle in "server resource manager"

In this way, it is easy to establish a connection with the Oracle database in Visual Studio,

Then, you need to complete the registration of membership in the Oracle database,

What about this,

You can use aspnet_regsql.exe to register an SQL Server database,

However, what is implemented here is the registration of Oracle rather than SQL Server,

From the preceding figure, we can see that I am using an Oracle database in Visual Studio.

Log on to the Oracle database as a Scott user,

To complete the registration of oracleaspnetproviders, you must have certain permissions in the database,

However, for Scott users alone, the registration is not successful because of insufficient permissions,

Of course, you can also use the System user, but this permission is also higher,

To complete the registration of oracleaspnetproviders, you must have the following permissions in the database,

  • Change Notification

  • Create job

  • Create procedure

  • Create public Synonym

  • Create role

  • Create session

  • Create Table

  • Create View

  • Drop public Synonym

  • Unlimited tablespace

    The following describes how to assign permissions to Scott users in Oracle databases,

    To assign permissions to Scott users, you must first log on to the Oracle database as a system user,

    This is very simple. You only need to log on as a system user under sqlplus,

    Then execute the following authorization statement,

    Grant change notification,

    Create job,

    Create procedure,

    Create public synonym,

    Create role,

    Create session,

    Create Table,

    Create view,

    Drop public synonym,

    Unlimited tablespace

    To "Scott"

    In this way, permissions can be allocated to Scott, the user to be registered in the Oracle database,

    Register oracleaspnetproviders,

    Choose "Tools"> "run SQL * Plus script" from Visual Studio ",

    Find the script file to be run. What about this script file,

    You must install the Oracle provider for ASP. NET component,

    However, in ODT. net, this component is generally inherited and, for example, a database of a higher version,

    For example, 10g or 11g.

    When installing the database, Oracle provider for ASP. NET will be installed at the same time,

    You must find your ODT. net installation directory,

    For example, on my machine,

    D: \ app \ Xiaozhen \ product \ 11.1.0 \ client_1 \ ASP. NET \ SQL

    There are many. SQL files in this directory. You can find a special one,

    You can directly run this script file to fully register your Oracle database,

    If you use NotePad to open the. SQL file marked above,

    You can find that this file is only a step-by-step running of other script files,

    Of course, if you do not want to register after the registration is completed, there is also a file in this directory,

    Uninstallalloracleaspnetproviders. SQL

    This file is used to cancel registration,

    Next we will go back to the above "run SQL * Plus script" topic,

    In this way, the Membership registration mechanism has been completed in the Oracle database,

    The following is the result of the above operation for SQL developer,

    14 new data tables are created here (only 11 data tables are created when SQL Server was previously registered ),

    These data tables are the tables required by Oracle to support the membership mechanism,

    We can also see that there are users tables, membership tables, and so on,

    Of course, the above registration process also creates a lot of stored procedures and views, index these,

    But I will not introduce it more here,

    As mentioned above, the Membership registration mechanism has been completed in the Oracle database,

    The next step is to introduce how to use the membership mechanism, but we will not introduce the use of the membership mechanism here,

    My focus is on how to use the membership mechanism registered in Oracle in the project,

    First, create a project, and then open the corresponding "ASP. NET Configuration tool (ASP. NET Website management tool)"

    Switch to provideProgramPage,

    Then select oraclemembershipprovider and oracleroleprovider ",

    However, the membership mechanism has not yet been fully established in Oracle databases,

    For example, you can switch the "ASP. NET configuration" tool to the "Security" page, you will find that,

    Obviously, although the Oracle database provider is specified, the database cannot be connected to the Oracle database,

    Because you have not provided a string to connect to the Oracle database, you certainly cannot connect to the Oracle database,

    So the following operations are,

    You can deploy your web project to your own IIS first,

    Then,

    Modify the connection strings of the two databases shown above.

    Data Source = ORACLE; persist Security info = false;

    User ID = Scott; Password = tiger ;"

    In this way, you can open the Web. config file of your project,

    You can find that,

    That is to say, all the operations we have done in IIS for Web websites are only settings for Web. config,

    If you are familiar with it, you can skip the previous step of using IIS to configure the database connection string,

    It is OK to directly complete in Web. config,

    Now, switch the "ASP. NET Configuration tool" to the "Security" page,

    You can see that you have successfully connected to the Oracle database,

    Then, we will use the "ASP. NET Configuration tool" to complete some operations,

    For example, to enable Forms authentication, such as creating a role, such as creating a user,

    This demonstrates the successful use of membership on the Oracle database,

    First, enable froms verification,

    Create another user,

    After creating a user, we will verify the user we just created from the Oracle database.BaobeimeWhether the creation is successful,

    From here, we can verify that a member qualification has been successfully established in Oracle,

    A qualified user baobeime is added !!!

     

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.