WebSphere Application Server, Version 6.1   
             オペレーティング・システム: AIX , HP-UX, Linux, Solaris, Windows, Windows Vista

             目次と検索結果のパーソナライズ化

例: Data Access Bean の使用

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();
		}
	}
}



関連資料
管理コンソールのボタン
管理コンソール・ページのフィーチャー
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 5:05:53 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/rdat_newdatbeans.html