Jonathan Baker wrote:

> In order to guarantee the statements (and corresponding resultset objects)
> close, try the following design pattern:
>
>   try {
>      Connection c = ic.lookup(...);
>
>      try {
>         Statement stmt = c.createStatement();
>
>         try {
>            .. perform your database processing here...
>
>         }
>       finally {
>          stmt.close();
>       }
>     }
>     finally {
>        c.close();
>     }
>   }
>   catch ( Exception ex ) {
>      .. exception processing ..
>   }
>
> Note that this pattern will guarantee the statement will close even if an
> exception is thrown during processing.
>
> Jonathan Baker
> Internet Applications Division
> Sybase, Inc.
>

Hi:-), sorry for bothering with a question:

0 I have ever used the following way in my Session Bean:
      ...
      InitialContext ic = new InitialContext();
      DataSource ds = (DataSource) ic.lookup(dbname);
      con =  ds.getConnection();
      ...

1 now I find you use:
     ...
     Connection c = ic.lookup(...);
     ...

2 so my questions are:
    # does it mean that with your EJB container, I can  directly get a
        java.sql.Connection by JNDI?
    #  if so:
         *  is this Connection from a DBConnection pool which is already
            in your EJB container?
         *  or you don't have a DBConnection pool in your EJB container-> you
            just make a new DBConnection for me?

because I want to know:
*   if I should make a DBConnection pool by myself?
*   or use another  DBConnection pool developed by other people?
*   or I don't need to use a DBConnection pool ?

Thanks in advance!

Bo
Nov.16, 2000

===========================================================================
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