Hi,
its me vikas and i need some some help in EJB
what i want to do is i want to access the disconnected database .
now i did some thing related to that
here is my bean class for that
*************************************************

package Safebean;

import javax.ejb.*;
import java.util.*;
import java.sql.*;
import javx.naming.*;
import java.sql.*;
import java.lang.*;
import safe.index1.*;

public SafeBMPBean implements EntityBean
{
EntityContext entityContext;
String P_name,txt_code,add1,add2,add3,pincode,city,pan_no,cst_no,con_person,email,che_credit,che_topay,cc_credit;
String sh="";

String username=(String)session.getAttribute("uname");
String year=(String)session.getAttribute("year");
String n_month=(String)session.getAttribute("n_month");
String date=(String)session.getAttribute("date");

Vector vc=new Vector();
indexBean inbean=new indexBean();

private transient EntityContext mContext=null;

Connection conn=null;
Statement st=null;
ResultSet rs=null;

if((Connection)session.getAttribute("conn")!=null)
{
conn=((Connection)session.getAttribute("conn"));
}
else
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn=DriverManager.getConnection("jdbc:oracle:thin:@corp-it:1521:orcl","vnegi","vnegi123");
session.setAttribute("conn",conn);
}


//public String ejbCreate(String P_name,String p_code,String add1,String add2,String add3,String pincode,String city,String pan_no,String cst_no,String con_person,String email,String che_credit,String che_topay,String cc_credit) throws CreateException
public String ejbCreate(String p_code) throws CreateException
{

//*************************** code for ejbCreate *****************************

try{
st=con.createStatement();
rs=st.executeQuery(sql);

partyname=inbean.getP_name();
counter=inbean.gettxt_code();
ii= Integer.parseInt(counter.trim());

add1=inbean.getadd1();
add2=inbean.getadd2();
add3=inbean.getadd3();
pincode=inbean.getpincode();
city=inbean.getcity();
pan_no=inbean.getpan_no();
cst_no=inbean.getcst_no();
con_person=inbean.getcon_person();
email=inbean.getemail();
ccc_code=inbean.getcc_credit();
che_topay=inbean.getche_topay();
che_credit=inbean.getche_credit();

String cr_yn;

if(che_credit.equals("null"))
{
cr_yn="N";
}
else
{
cr_yn="Y";
}


String topay_yn;
if(che_topay.equals("null"))
{
topay_yn="N";
}
else
{
topay_yn="Y";
}



if(e_month.equals("1"))
{
e_month="Jan";
}
else if(e_month.equals("2"))
{
e_month="Feb";
}
else if(e_month.equals("3"))
{
e_month="Mar";
}
else if(e_month.equals("4"))
{
e_month="Apr";
}
else if(e_month.equals("5"))
{
e_month="May";
}
else if(e_month.equals("6"))
{
e_month="Jun";
}
else if(e_month.equals("7"))
{
e_month="Jul";
}
else if(e_month.equals("8"))
{
e_month="Aug";
}
else if(e_month.equals("9"))
{
e_month="Sep";
}
else if(e_month.equals("10"))
{
e_month="Oct";
}
else if(e_month.equals("11"))
{
e_month="Nov";
}
else
{
e_month="Dec";
}


String sqls="";
String sqls1="";
int rowcount;
int comm=0;
int per_pack=0;
int per_ton=0;

sqls="insert into Partymas values('','','','"+ii+"','"+partyname+"','c','"+add1+"','"+add2+"','"+add3+"','"+pincode+"','"+email+"','"+cst_no+"','"+con_person+"','"+pan_no+"',"+comm+","+per_pack+","+per_ton+",'','"+e_date+"-"+e_month+"-"+e_year+"','"+username+"','','','"+city+"','"+cr_yn+"','"+topay_yn+"','','','"+ccc_code+"')";

st.executeQuery(sqls);

return p_code;
}
catch(SQLException e)
{
e.printStackTrace();
throw new CreateException();
}
catch(NamingException e)
{
e.printStackTrace();
throw new CreateException();
}

//*************************** end of ejbCreate code **************************
}
public String ejbActivate() throws EJBException,RemoteException
{

//*************************** code for ejbActivate *****************************


//*************************** end of ejbActivate code **************************
}
public void ejbLoad()throws EJBException,RemoteException
{
try
{

//*************************** code for ejbLoad **************************

loadFromDB();

//*************************** end of ejbLoad code **************************

}catch(Exception e)
{
System.out.println("Failed to load Bean :-");
e.printStackTrace();
throw new RemoteException("ejbLoad failed :-",e);
}

}

public void ejbStore()throws EJBException,RemoteException
{
//*************************** code for ejbStore**************************
try
{
//*************************** code for ejbLoad **************************

loadtoDB();

//*************************** end of ejbLoad code **************************

}catch(Exception e)
{
System.out.println("Failed to Store Bean :-");
e.printStackTrace();
throw new RemoteException("ejbStore failed :-",e);
}


//*************************** end of ejbStore code **************************
}
public void ejbPassivate()throws EJBException,RemoteException
{
//*************************** code for ejbPassivate **************************


//*************************** end of ejbPassivate code **************************
}
public void ejbPostCreate()
{
//*************************** code for ejbPostCreate **************************


//*************************** end of ejbPostCreate code **************************
}
public void ejbRemove()
{
//*************************** code for ejbRemove **************************

String pcode=inbean.gettxt_code();
String str="delete from partymas where party_code like '"+pcode+"'";
st.executeQuery(str);


//*************************** end of ejbRemove code **************************
}
public Vector ejbFindByPrimaryKey(String p_code)throws RemoteException,FinderException
{
//*************************** code for ejbFindByPrimaryKey **************************
try
{
Vector vc=new Vector();
sql="select * from partymas where party_code='"+p_code+"'";
st=con.createStatement();
rs=st.executeQuery(sql);

ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();

while(rs.next())
{
for(int i=1; i<=cols; i++)
{
Object value = rs.getObject(i);
vc.add(value);
}
return vc;
}
}catch(SQLException e)
{
System.out.println("Failed to getByPrimary Key Bean :-");
e.printStackTrace();
throw new RemoteException("ejbFindByPrimaryKey failed :-",e);
}


//*************************** end of ejbFindByPrimaryKey code **************************
}
public void ejbFindByName(String p_name)throws RemoteException,FinderException
{
try
{
Vector vc=new Vector();
sql="select * from partymas where party_name='"+p_name+"'";
st=con.createStatement();
rs=st.executeQuery(sql);
ResultSetMetaData rsmd = rs.getMetaData();
        int cols = rsmd.getColumnCount();
while(rs.next())
{
for(int i=1; i<=cols; i++)
{
Object value = rs.getObject(i);
vc.add(value);
}
return vc;
}
}catch(SQLException e)
{
System.out.println("Failed to getByPrimary Key Bean :-");
e.printStackTrace();
throw new RemoteException("ejbFindByPrimaryKey failed :-",e);
}

}
public void ejbFindByCity(String city)throws RemoteException,FinderException
{
try
{
Vector vc=new Vector();
sql="select * from partymas where station_code='"+city+"'";
st=con.createStatement();
rs=st.executeQuery(sql);

ResultSetMetaData rsmd = rs.getMetaData();
    int cols = rsmd.getColumnCount();

while(rs.next())
{
       for(int i=1; i<=cols; i++)
{
Object value = rs.getObject(i);
vc.add(value);
}
return vc;
}
}catch(SQLException e)
{
System.out.println("Failed to getByPrimary Key Bean :-");
e.printStackTrace();
throw new RemoteException("ejbFindByPrimaryKey failed :-",e);
}


//*************************** end of ejbFindByCity code **************************
}
public Vector loadFromDB()
{
//*************************** code for load from database *****************************
try
{
Statement st,st1=null;
ResultSet rs=null;

st=conn.createStatement();
String sqls1="select * from Partymas order by to_number(party_code)";
rs=st.executeQuery(sqls1);

ResultSetMetaData rsmd = rs.getMetaData();
        int cols = rsmd.getColumnCount();

while (rs.next())
{
for(int i=1; i<=cols; i++)
{
Object value = rs.getObject(i);
vc.add(value);
}
return vc;
}
}catch(Exception e)
{
System.out.println("Failed to load Bean :-");
e.printStackTrace();
throw new RemoteException("ejbLoad failed :-",e);
}

}
public void loadtoDB()
{

String partyname=inbean.getP_name();
String add1=inbean.getadd1();
String add2=inbean.getadd2();
String add3=inbean.getadd3();
String pincode=inbean.getpincode();
String city=inbean.getcity();
String pan_no=inbean.getpan_no();
String cst_no=inbean.getcst_no();
String con_person=inbean.getcon_person();
String email=inbean.getemail();
String topay_yn=inbean.getche_topay();
String cr_yn=inbean.getche_credit();
String cc_credit=inbean.getcc_credit();

String m_mon;
if(m_month==1)
{
m_mon="Jan";
}
else if(m_month==2)
{
m_mon="Feb";
}
else if(m_month==3)
{
m_mon="Mar";
}
else if(m_month==4)
{
m_mon="Apr";
}
else if(m_month==5)
{
m_mon="May";
}
else if(m_month==6)
{
m_mon="Jun";
}
else if(m_month==7)
{
m_mon="Jul";
}
else if(m_month==8)
{
m_mon="Aug";
}
else if(m_month==9)
{
m_mon="Sep";
}
else if(m_month==10)
{
m_mon="Oct";
}
else if(m_month==11)
{
m_mon="Nov";
}
else
{
m_mon="Dec";
                                   }

String sqls="";

sqls="update partymas set party_name='"+partyname+"',add1='"+add1+"',add2='"+add2+"',add3='"+add3+"',pin_code='"+pincode+"',Station_code='"+city+"',pan_no='"+pan_no+"',cst_no='"+cst_no+"',contact_per='"+con_person+"',email='"+email+"',cr_yn='"+cr_yn+"',topay_yn='"+topay_yn+"',ccc_code='"+ccc_code+"',modify_date='"+m_date+"-"+m_mon+"-"+m_year+"',modify_by='"+username+"' where party_code = '"+partycode+"' and party_name='"+partyname+"'";

st.executeUpdate(sqls);

}
public void unsetEntityContext()
{
this.entityContext=null;
}
public void setEntityContext(EntityContext entityContext)
{
this.entityContext=entityContext;
}

}