import javax.ejb.*;
import java.sql.*;
import javax.sql.*;
import java.awt.event.*;
import javax.naming.*;
import java.awt.*;
import java.util.*;
import java.rmi.*;

public class DatabaseBean implements SessionBean{

        SessionContext ctx;

        public void ejbCreate(){
        }
        public void ejbRemove(){

    }
        public void setSessionContext(SessionContext ctx)
        {
                this.ctx = ctx;
        }
        public void ejbActivate()
        {
        }
        public void ejbPassivate()
        {
        }

        public int connectDatabase(){

                Connection con=null;
                int i=0;
                Context ctx =   null;

        try {
            ctx = new InitialContext();
            DataSource ds = (DataSource)ctx.lookup("java:/TryDB");
                con = ds.getConnection();
                Statement stmt=con.createStatement();

        ResultSet rs=stmt.executeQuery("select * from model");
                while(rs.next()){
                                i++;
                }
        }catch(Exception ne) {
                System.out.println("naming exception "+ne);
        } finally {
                if(con != null)
                        try {con.close();} catch(SQLException e) {}
            }
                return i;
        }

}

With Regards,
Vinoth.C

> -----Original Message-----
> From: Creighton Kirkendall [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, April 06, 2001 6:48 PM
> To:   '[EMAIL PROTECTED]'
> Subject:      [JBoss-user] Need Help Connection Pools (can't see zip
> files)
> 
> I want to thank you Vinoth.C for your quick response.  However because I
> get these messages in a batch file I can't read zips.  I can read them if
> you cut an passed one of the bean implementation into a message. 
>  
> Creighton Kirkendall

This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or 
copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

                Visit us at http://www.cognizant.com


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to