You bet, Ramesh. Just have your SFSB grab the data source and then fire off
the JDBC calls as you normally would. For example, something like the
following:

public String[] myBeanMethod() {
  DataSource ds = null;
  Connection conn = null;
  PreparedStatement ps = null;
  ResultSet res = null;
  try {
    Context ctx = new InitialContext();
    ds = (DataSource)ctx.lookup("java:comp/env/jdbc/my_DS");
  }
  catch (NamingException ne) {
    throw new EJBException(ne);
  }
  try {
    conn = getConnection();
    ps = conn.prepareStatement("SELECT my_column FROM my_table");
    res = ps.executeQuery();

    // yada yada yada...

  }
  catch (Exception e) {
    throw new EJBException(e);
  }
  finally {
    try {
      if (res != null) res.close();
      if (ps != null) ps.close();
      if (conn != null) conn.close();
    }
    catch (SQLException se) {
      se.printStackTrace();
    }
  }
}

Hope this helps,

Ted

------------------
Ted Osborne
http://www.tedosborne.com


> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kesav, Ramesh
> Sent: Monday, May 20, 2002 7:01 AM
> To: [EMAIL PROTECTED]
> Subject: SFSB with DB
>
>
> Hi all,
>
>  is it possible to access DB thru SFSB without EB? if so how?
>
> Regards
>
> Ramesh Kesavanarayanan
> [EMAIL PROTECTED]
> Off: 91-44-8113801 ext 2333
> Res:91-44-2265360
> Mob : 91-98412-73573
>
> ==================================================================
> =========
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to