Back to project page foodroid.
The source code is released under:
GNU General Public License
If you think the Android project foodroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wmc.Registration; /*from w w w . ja v a 2 s . co m*/ import java.sql.*; import javax.annotation.Resource; import javax.faces.bean.ManagedBean; import javax.sql.DataSource; import javax.sql.rowset.CachedRowSet; @ManagedBean( name="ReserveListBean" ) public class ReserveListBean { public ResultSet getReserves() { Connection connection = null; PreparedStatement getReserves = null; CachedRowSet rowSet = null; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(Settings.DATABASE_URL, Settings.DATABASE_USER, Settings.DATABASE_PASS); if ( connection == null ) throw new SQLException( "Unable to connect to DataSource" ); getReserves = connection.prepareStatement( //ID, BranchName, Username, Address, Tel, Date, Time, TableName, TableSize "SELECT *" + "FROM Vw_OrderTableList ORDER BY ID" ); rowSet = new com.sun.rowset.CachedRowSetImpl(); rowSet.populate( getReserves.executeQuery() ); } catch(Exception e) { e.printStackTrace(); } finally { try { getReserves.close(); connection.close(); } catch(Exception e) { e.printStackTrace(); } } return rowSet; } }