Using the MySQL Workbench query editor or the Command Terminal, copy the following code below. Observation: I created a function where 1 is true and the username is logged-in and 0 is false where the username is not found in the data base or fails to log-in. 2. Execute the SQL code. 3. Using the MySQL Workbench query editor or the Command Terminal, copy the following code below. Observation: After creating new function, I used it in create procedure.
4. Execute the SQL code. 5. Test the Stored Procedure and Function by copying the following code and executing it. 6. Inserting an existing Account record will result in 1 else it will be 0. Observation: I called the LoginUser that is added on the database and used the username and password that I created in the previous procedure. As you can see on the screenshot it shows 1, meaning the user successfully logged in This is the result of successfully call for loginuser. 7. Modify the login.py code by replacing the codes in the Python function authenticateUser() with the code below. The ones emphasized with red lines are the codes that were changed.
Observation: I modified the login.py that I created earlier 8. Run login.py and validate the result again. The output should be the same with procedures 5 and 6. MS SQL Database Connection 1. Login to the SQL Server Management Studio using your credentials. 2. Create the database mydb_<lastname>. Observation: I created a database in SQL Server Management Studio 3. Create the Accounts table and insert at least two values to the table.
4. Insert at least two values to the table. Observation: I created a table named account and added 2 values in the table 5. Create the scalar-valued stored function named authenticateUser.
Observation: I created a scalar-valued function and named it as AuthenticateUser 6. Create the stored procedure login.
Observation: I created a stored procedure named Loginnew 7. Test the stored procedure and function. 8. The result of the login_status should be similar earlier on the MySQL. 9. Modify the SQLDBConnector.py with the code below SUPPLEMENTARY ACTIVITY
1. The database that will be used is the ABCLibrary database. You may use an existing ABCLibary database or create a new one.
- Fall '16