• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Do you need to make a java file for your datasource or connection pool?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you need to make a java file for your datasource or connection pool? Or do you just add the following lines in your fooBean.java code? Please do let me know.
Ronak
private Connection getConnection() throws EJBException
{
try
{
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/GangsterDB");
return ds.getConnection();
}
catch(Exception e)
{
throw new EJBException(e.getMessage());
}
}
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That should work, just like the spec says.
You of course also have to do the configuration:
In weblogic console, make a connection pool and make a datasource for that pool.
In ejb-jar.xml, make a res-ref for jdbc/GangsterDB
In weblogic-ejb-jar.xml, bind that resource ref to the jndi name of the data source.
That's all there is.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic