![]() |
![]() |
![]() |
|
![]() |
|
![]() |
java.sql
Code Samples Index These code examples and other materials are subject to Sun Microsystems, Inc. Legal Terms
Getting Particular Rows from a Database TableThis example retrieves all rows from a table called ``mytable'' whose column COL_A equals ``Patrick Chan''. A row in ``mytable'' consists of a string, integer, and floating point number.try { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM mytable WHERE COL_A = 'Patrick Chan'"); rs.next(); String s = rs.getString("COL_A"); int i = rs.getInt("COL_B"); float f = rs.getFloat("COL_C"); process(s, i, f); } catch (SQLException e) { }
|
[ This page was updated: 11-Sep-2000 ] |
|
For more information on Java technology and other software from Sun Microsystems, call: (800) 786-7638 Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first. |
![]() Copyright © 1995-2000 Sun Microsystems, Inc. All Rights Reserved. Terms of Use. Privacy Policy. |