Grokking Java Interview Questions
Vote

0% completed

​

JDBC and Prepared Statements

A store page finds the orders of one customer with this line of Java:

String sql = "SELECT id FROM orders WHERE customer = '" + name + "'";

The line works for Ana and for Ben. It fails for the input Ben's, and another input makes it return the orders of every customer. The input of the user becomes part of the query text, and the database cannot tell the two apart.

The four questions below follow a query from Java to the database. They cover the steps of a query, the safe way to pass values, the reuse of connections, and the number of messages that a program sends.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content