/* * @(#)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.ejb; import javax.ejb.*; import java.sql.*; import java.util.Vector; /** * JdbcEJBEJB class. * @author LiL CJ * @version 1.00 02/06/2000 */ public class JdbcEJBEJB implements SessionBean { Vector v; 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 Vector rset() throws SQLException,ClassNotFoundException{ v = new Vector(); Class.forName("gwe.sql.gweMysqlDriver"); Connection conn = DriverManager.getConnection ("jdbc:mysql://:3306/siteindex2","OMITTED","OMITTED"); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery ("SELECT * FROM thesites"); while (rs.next()) { String id = rs.getString(1).trim(); String itsgroup = rs.getString(2).trim(); String title = rs.getString(3).trim(); String url = rs.getString(4).trim(); String thedate = rs.getString(5).trim(); v.addElement(id+" "+itsgroup+" "+title+" "+url+" "+thedate+"\n"); } this.v = v; return v; } }