Database Reference
In-Depth Information
COMMIT;
A brute-force way to increment a sequence without inserting records is to SELECT SEQUENCE.NEXTVAL
a sufficient number of times. You can also set the INCREMENT BY value to a negative number to reduce the
value of LAST_NUMBER in a sequence.
We can see the new LAST_NUMBER setting in EMPLOYEES_SEQ by selecting it again. Assure that it is 300,
and then insert our example record for EMPLOYEE_ID = 300. Finally COMMIT the updates. See our new entry
by selecting:
SELECT * FROM employees WHERE employee_id=300;
I should mention that there is an existing INSERT / UPDATE / DELETE trigger on the EMPLOYEES table
named SECURE_DML . This trigger limits changing the EMPLOYEES data to weekdays from 8 AM to 6 PM. It is
similar to the restrictions we enforced in Chapter 2. However, by default this trigger is disabled.
Demonstrations and Tests of Encrypted Data Exchange
We are going to execute a separate Java class, TestOracleJavaSecure to emulate a client application of
the HR schema. Our client application will call the stored procedures that we defined within the
hr_sec_pkg , doing several queries and a few updates.
We will only explore several small and large snippets of the application code. You should have the
TestOracleJavaSecure.java file open to refer to while we go through this section.
Note You can find this code in the file Chapter7/TestOracleJavaSecure.java .
Some Preliminary Steps
Before we get into the big individual demonstrations and tests, we want to get our bearings. The next few
subsections set us up for the demonstrations and tests that follow.
The main() Method and Method Members
The entire code of the TestOracleJavaSecure class resides within the main() method. So, we simply run
the code from top to bottom when we call Java with this class from the command line.
The first thing we do in the main() method is establish an Oracle connection, shown in Listing 7-18.
Edit the connection string to use the password you assigned to the Application User, appusr , and with
your specific server name and port.
Listing 7-18. Beginning of Code to Test Encryption in Transit, TestOracleJavaSecure Class
public class TestOracleJavaSecure {
public static void main( String[] args ) {
Connection conn = null;
try {
private static String appusrConnString =
"jdbc:oracle:thin:AppUsr/password@localhost:1521:Orcl";
 
Search WWH ::




Custom Search