November 2015
Beginner
464 pages
9h 46m
English
Queries can be executed using two different kinds of statements. Simple queries can be executed using static statements, while prepared statements allow the changing of parameters before execution.
To execute a static SQL statement, a Statement object has to be obtained from the Connection object first:
Statement statement = connection.createStatement();
The Statement can then be used to execute queries or updates on the target database.
As with the connection, it is good practice to close a statement as soon as it stops being used. If the statement is not closed, it will be closed implicitly when the underlying connection is closed.
The following example shows the way to get data from a table ...
Read now
Unlock full access