20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How It Works<br />

After you run this statement, you will see a role in the database called DataEntry that can be used to<br />

assign privileges allowing users to add data to tables. The role Management can be used to run reports to<br />

view data entered by DataEntry. Once the roles are created, you then add one or more members to each<br />

role. All that’s left is to assign privileges to roles (and members if desired).<br />

Objects<br />

The <strong>SQL</strong> standard defines security in terms of objects on which actions can be performed. In the <strong>SQL</strong>1<br />

standard, the only objects that security applied to were tables and views. Thus, privileges were assigned<br />

to a user ID to perform an action on a table or a view. If a user is not granted a privilege to an object,<br />

then that user can’t access that object. <strong>SQL</strong>2 extended the security syntax and added new objects such as<br />

user-defined character sets and domains.<br />

Figure 12-4 shows that user ID Fred is granted SELECT privileges on tblPersonnel, whereas user ID<br />

John is granted SELECT privileges on tblPersonnel as well as UPDATE privileges on tblOrders.<br />

Figure 12-4<br />

Fred<br />

Grant Select<br />

TBL Personnel<br />

Grant Select<br />

Grant Update<br />

TBL Orders<br />

Modern DBMSs have added additional objects to the security syntax to cover objects such as stored procedures<br />

in <strong>SQL</strong> Server. Stored procedures are programming functions that can be created by users and<br />

that can perform all sorts of tasks. The ability to create and drop these functions can be controlled by the<br />

security system, with certain user IDs granted permission to create or drop stored procedures, while<br />

others are not. In some cases, the physical tablespaces where tables are created and stored are treated<br />

as security objects, with user IDs granted permission to create tables in a given tablespace. In essence,<br />

the modern DBMS has simply extended the <strong>SQL</strong> syntax to allow granting of privileges to objects not<br />

considered by the <strong>SQL</strong> standard. These extensions vary from DBMS to DBMS, and because the extensions<br />

are specific to the DBMS, the methods used to grant these privileges vary considerably.<br />

John<br />

<strong>SQL</strong> Security<br />

335

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!