Retrieving Data Using JDBC
Retrieve data through the JDBC API by implementing the following three steps:
Obtain a driver and establish a connection to a database.
Send an SQL statement to the database and retrieve data.
Assign the data returned from the database to local variables.
The following sections introduce methods you can use to implement each of the three steps used to retrieve data through the JDBC API while you write an example bean, the DatabaseAccess bean, shown in Listing 14.1.
Tip
The DataAccess bean is hard coded to use a JDBC-ODBC Bridge text driver configured with the directory selected containing the database text files. See the previous section, "Setting Up an ODBC Driver," for more information.
Listing 14.1 Source code for ...
Get JavaBeans Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.