Lab 15
Lab 15
Database Output:
I. Initial Setup
1. Ensure that the MySQL service is running through XAMPP.
-Before starting, I open the XAMPP and click start in Mysql so that it will
connect to the database.
-After creating the database, I inserted a table to it named accounts with its
primary key.
3. Insert at least 2 records into the Accounts table.
-The table is successfully added to the database, and I inserted two values to
it.
. 4. Open your Python editor and copy the following code to your program
and then run/execute the program shown below:
-This is the code copied from the module.
5. The connection should be established successfully.
3. Save the changes to the file and run using the Python editor or the
command prompt.
4. The output should appear similar to the image below.
-After doing the required task this is the GUI created.
-I tried to fill the text box and use the username and password that I inserted
in the table accounts. As you can see after logging-in the user is successfully
validated.
You may use one of the two accounts instructed to be created earlier in the
activity. Both of them should be successfully validated.
6. Enter a username and password that does not match a record in the
created Accounts table. The output should look similar to the one below.
-This is the result when the username and password is nit inserted in table
accounts of the database mydb_dizon.A message box shows that user
validation failed.
-After executing the query, this is successfully applied on the LoginUser that
I created.
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>.
3. Create the Accounts table and insert at least two values to the table.
-Inserted a new table named accounts.
-This is the result after executing the command, it is different from the result
that I get in SQL workbench.
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
Do the following tasks and copy screenshot(s) of your output using Microsoft
SQL Server Management Studio.
1. The database that will be used is the ABCLibrary database. You may
use an existing ABCLibary database or create a new one.
-In this figure, I created a database ABCLibrary and inserted new tables to it
that can be used later on. These tables are book, customers, and book order.
2. Create a GUI application that can insert, delete and modify the book
information in ABCLibrary Database.
-This is the main window from the GUI that I created.
-This the GUI when you insert record to the abc library.
3. Create stored procedures that can insert, delete and modify the book
information using the book table in ABCLibrary database.
4. Call the stored procedures from your book information.
------------------------------------------------------------------------------------------------------------
---------
SUMMARY:
The topics that were discussed in this activity lab are:
Use of host
Use of port
Use of db in mysql
Use of user in mysql
Use of password even if it is optional
Use stored procedure, function and trigger inside a program.
Connecting mysql and ssms into an application or program
Difference between SSMS vs MySQL
CONLCUSION:
In this lab activity I conclude that SSMS is better than MySQL because
some parts in MySQL are limited like the stored function, in MySQL you can
only use scalar function while in SSMS you can use Inline single table, multi-
line table and scalar function.
RECOMMENDATION:
I recommend to use SSMS than MySQL because if you’re going to
make an application or program that shows table or uses table it’s better to
use SSMS.
LESSON LEARNED:
In this laboratory activity I learned:
Use of host
Use of port
Use of db in mysql
Use of user in mysql
Use of password even if it is optional
Use stored procedure, function and trigger inside a program.
Connecting mysql and ssms into an application or program
Difference between SSMS vs MySQL