Well, I only use JSP/Beans right now... And the location is

pooled-location="jdbc/MyPooledDS"

I assume this should be sufficient if no transactions are used. However if
there is a performance penalty using this "pooled-location" compared to
ejb-location I would like to know.

Johan

----- Original Message -----
From: "Jens Stutte" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Wednesday, June 20, 2001 5:16 PM
Subject: AW: Newbie - using EJB and databases


> Hi all,
>
> the code seems correct, however the "jdbc/MyPooledDS" location name does
not
> explain, which of the names specified in datasources.xml you should lookup
> (this may have dramatic consequences both for performance and integrity).
>
> In datasources.xml, you can specify names for three locations, like:
>
> location="jdbc/BaseDB"
> xa-location="jdbc/xa/BaseXADB"
> ejb-location="jdbc/BaseEJBDB"
>
> >From within a servlet and/or a JSP page, you normally use the "location".
> >From within a session- or BMP-entity-bean, you must use the
"ejb-location",
> to ensure the proper function of container managed transactions (BTW, this
> also works much faster than using the normal "location"). I never used the
> "xa-location", i don't know where it may be usefull.
>
> Best regards,
>
> Jens Stutte
>
> > -----Ursprüngliche Nachricht-----
> > Von: Johan Fredriksson [mailto:[EMAIL PROTECTED]]
> > Gesendet am: Mittwoch, 20. Juni 2001 13:52
> > An: Orion-Interest
> > Betreff: Re: Newbie - using EJB and databases
> >
> > This is how I always do....
> >
> >
> > import java.sql.*;
> >
> > public class DB {
> >  private static javax.sql.DataSource ds = null;
> >
> >  //Initieringsblock
> >  static {
> >   String dbsource = "jdbc/MyPooledDS";
> >
> >   try
> >   {
> >    javax.naming.Context ctx = new javax.naming.InitialContext();
> >    if (ctx == null) {
> >     System.out.println("No context!");
> >    }
> >    ds = (javax.sql.DataSource)ctx.lookup(dbsource);
> >   }
> >   catch(javax.naming.NamingException namExc)
> >   {
> >    ds = null;
> >    namExc.printStackTrace();
> >    throw new java.lang.RuntimeException("Failed to get datasource!!");
> >
> >   }
> >  }
> >
> >  public DB()  {}
> >
> >  public static java.sql.Connection getConnection() throws
> > java.sql.SQLException {
> >   return ds.getConnection();
> >  }
> >
> >
> > }
> >
> >
> > then I just call
> >
> > Connection conn = DB.getConnection();
> >
> > from my apps/beans/whatever
> >
> >
> > Johan
> > ----- Original Message -----
> > From: "kevin1" <[EMAIL PROTECTED]>
> > To: "Orion-Interest" <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 20, 2001 2:06 AM
> > Subject: Newbie - using EJB and databases
> >
> >
> > >
> > > Hello all,
> > > I am still new to the whole EJB thing, but I have a grasp
> > on it.  However,
> > > the one thing I am foggy on is how to use a database.  I
> > know that I set
> > up the
> > > db connection in the data-sources.xml file, but what is the
> > syntax to use
> > that
> > > in an application?  Where could I find an example of that?
> >
> >


Reply via email to