WAS v8.5 > Reference > Developer detailed usage informationData access bean types
For easy data access programming, WebSphere Application Server provides a special class library that implements many methods of the JDBC API for you. The library is essentially a set of Service Data Objects (SDO).
To make things clearer, we can refer to the classes by the name of the JAR file containing them:
databeans.jar - This JAR file ships with WAS. This file contains classes that enable you to access the database using the JDBC API.
ivjdab.jar - This JAR file ships with Visual Age for Java. This file contains all of the classes in the databeans.jar file and classes that support easy use of the data access beans from the Visual Age for Java Visual Composition Editor.
dbbeans.jar - This JAR file ships with Rational Application Developer. This file contains a set of data access beans to more closely conform to the JDBC 2.0 RowSet standard.
The com.ibm.db package is provided to support existing applications that use data access beans.
IBM strongly suggests that any new applications using data access beans be developed using the com.ibm.db.beans package provided with Rational Application Developer.
Example: Using data access beans. Data access beans are essentially a class library that makes it easier to access a database. The library contains a set of beans with methods that access the database through the JDBC API. This example shows using data access beans in WAS v5 and later to create new applications that use the com.ibm.db.beans package.
package example; import com.ibm.db.beans.*; import java.sql.SQLException; public class DBSelectExample { public static void main(String[] args) { DBSelect select = null; select = new DBSelect(); try { // Set database connection information select.setDriverName("COM.ibm.db2.jdbc.app.DB2Driver"); select.setUrl("jdbc:db2:SAMPLE"); select.setUsername("userid"); select.setPassword("password"); // Specify the SQL statement to be executed select.setCommand("SELECT * FROM DEPARTMENT"); // Execute the statement and retrieve the result set into the cache select.execute(); // If result set is not empty if (select.onRow()) { do { // display first column of result set System.out.println(select.getColumnAsString(1)); System.out.println(select.getColumnAsString(2)); } while (select.next()); } // Release the JDBC resources and close the connection select.close(); } catch (SQLException ex) { ex.printStackTrace(); } }}
Related concepts:
Data access beans
Reference:
Data access: Resources for learning