10.07.2015 Views

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Step 4: Execute a query and return a ResultSet objectTo query the database, use the executeQuery() method of your Statementobject. This method takes an SQL statement as input and returns an object ofthe <strong>JDBC</strong> ResultSet class.To continue the example, once you create the Statement object stmt, thenext step is to execute a query. The following example populates aResultSet object with the contents of the name column of a database classnamed resort:ResultSet rset = stmt.executeQuery ("SELECT name FROM resort");<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 22Chapter: 3. Basic FeaturesSection: First steps in <strong>JDBC</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!