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; //w w w . j a v a2s . 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="OrderListBean" ) public class OrderListBean { public ResultSet getOrders() { Connection connection = null; PreparedStatement getOrders = 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" ); getOrders = connection.prepareStatement( //ID, BranchName, Username, Address, Tel, Date, Time, Price "SELECT *" + "FROM vw_orderlist ORDER BY ID" ); rowSet = new com.sun.rowset.CachedRowSetImpl(); rowSet.populate( getOrders.executeQuery() ); } catch(Exception e) { e.printStackTrace(); } finally { try { getOrders.close(); connection.close(); } catch(Exception e) { e.printStackTrace(); } } return rowSet; } }