/* * @(#)JdbcEJBEJB.java 1.00 2/6/2000 */ /* ***************************************************************************** Copyright 2000 by Erica Andrews (cylikon@hotmail.com). All rights reserved. ./ButchWhipAppeal/ ./IcedPinky/ NO portion of this software may be used in ANY way by anyone other than myself without my express written consent. If it is downloaded for testing, it must be deleted from your system within 24 hours. Any other use constitutes piracy and fraudulent misuse of this software, punishable in a court of law. Copyright 2000 by Erica Andrews. All rights reserved. ***************************************************************************** */ package cylikon.ejb2; import javax.ejb.*; import java.sql.*; import java.util.Vector; import sun.jdbc.rowset.*; import javax.sql.*; /** * JdbcEJBEJB class. * @author LiL CJ * @version 1.00 02/06/2000 */ public class JdbcEJBEJB2 implements SessionBean { public CachedRowSet crs; private SessionContext context; /** * A container invokes this method to start * the life of the session object. */ public void ejbCreate() throws CreateException { } /** * A container invokes this method before it ends * the life of the session object. */ public void ejbRemove() { } /** * The activate method is called when the instance * is activated from its "passive" state. */ public void ejbActivate() { } /** * The passivate method is called before the instance * enters the "passive" state. */ public void ejbPassivate() { } /** * Set the associated session context. */ public void setSessionContext(SessionContext ctx) { context = ctx; } public CachedRowSet rset() throws SQLException,ClassNotFoundException{ Class.forName("gwe.sql.gweMysqlDriver"); Connection conn = DriverManager.getConnection ("jdbc:mysql://:3306/siteindex2","OMITTED","OMITTED"); crs = new CachedRowSet(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery ("SELECT * FROM thesites"); // store the result set into the CachedRowSet crs.populate(rs); rs.close(); stmt.close(); conn.close(); this.crs = crs; return crs; } // the method below is used for freeing system resources by cleaning out the ResultSet, // and to make sure no old data lingers in the CachedRowSet from old queries public void ResultSetCleanUp () throws SQLException{ crs.close(); } } // end of Class