Week 6 – CST– 363 Introduction to Database Systems

Summarize what you have learned this week. 

This week, I have learned how to design a database ERD more efficiently. The relationship lines can be used to show the type of relationship two entities share. The dotted lines indicate non-identifying relationships, and the solid lines indicate identifying relationships. In a non-identifying relationship, the child entity has a foreign key from the parent, but it does not make up the child’s primary key. In an identifying relationship, the foreign key is part of the primary key. In a good design, you want to keep primary keys minimal without unnecessary columns.

This week we are learning how to code a web application that uses a database. We are using JDBC which stands for Java Database Connectivity. We are using Connector/J which is the official JDBC driver for MySQL.

In order to use the database, you must first create a connection using the DriverManager.getConnection() method. You must specify a database server address, a database name, login username, and password. Connections are created in a try-block of a try-catch statement because the connection will fail if the database is not found, or the login credentials are invalid.

I also learned about the SQL Injection Attack. This is an attack that can happen when a “clever user” enters a sequence of characters like 0’ or ‘1’=’1 into a query that is constructed using string concatenation. This results in a select statement like Select * from instructor where name = ‘0’ or ‘1’ = ‘1’, which returns all rows from the table. Using a prepared statement prevents SQL injection when assigning values to placeholders.

Comments

Popular posts from this blog