Create Filters for Data with PreparedStatement


show more Filtering data with prepared statements provides you with in-depth training on Developer. Taught by David Gassner as part of the Java Database Integration with JDBC show less
please wait ...

Filtering data with prepared statements

So far in this video series, I have shown you how to work with static SQL statements, statements that are the same when programmed, and when executed at runtime. But in many applications, you'll need to use parameterized SQL statements, statements where there are placeholders that you fill in with variable values at runtime. In JDBC, you do this with a class called PreparedStatement. The PreparedStatement class lets you set up an SQL statement as a string with these placeholders and then fill them in with variable values.

I'll demonstrate this in the project Prepared Statements. In this version of my console application, I have a static string representing the SQL statement. Right now, I'm retrieving all of the data from the Tours table. And then, when I display the data using this version of the displayData method, I'm first moving the ResultSet cursor to the end of the ResultSet, then getting the row to find out how many rows I got back. And then, if I got back zero, I say there w...

Filtering data with prepared statements
Video duration: 6m 58s 2h 51m Intermediate

Viewers:

Filtering data with prepared statements provides you with in-depth training on Developer. Taught by David Gassner as part of the Java Database Integration with JDBC

Subject:
Developer
Software:
Java
Author:
please wait ...