Web hosting plans - Executing a Query with No Results 91 Once

Executing a Query with No Results 91 Once all of the controls have been created and attached to the application, the frame is sized and displayed to the user. At this point, the user can select an account number on the JList control and click on the Get Account button to display the information on the GUI. Figure 5.4 shows an example of what the output will look like when this is performed. Figure 5.4 Displaying a full record. Executing a Query with No Results Up to now, we have been concentrating on pulling information from the database using a SELECT command. Connector/J, SQL, and MySQL also allow information to be inserted and updated as needed. The operations of insert, delete, and update are considered no-result queries because they don t return a ResultSet object after being executed. For this reason, we don t use the executeQuery() method but instead use a method called executeUpdate(). The signature for the method is int executeUpdate(String SQL); The method accepts a single String parameter, which represents the query to be executed. The query shouldn t cause the database server to return a ResultSet, so no SELECTs are allowed. As you can see, the method will return an integer value after the query is performed. This integer represents the total number of rows affected by the query. The question arises, though, about the actual query statements that do not return a ResultSet. There are quite a few; let s look at the following ones: insert Puts a new row into the database table. delete Removes a row from the database table. update Updates an existing row in the table. drop table Removes a complete table from the database. create table Builds a new table. alter table Changes aspects of the table.
Note: If you are looking for cheap and inexpensive provider to host and run your tomcat application check professional tomcat hosting services

Comments are closed.