• 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

DataSource....

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Can anyone explain me on what happens when we use the following.
For Example;
InitialContext icx = new InitialContext();
DataSource ds = (DataSource)icx.lookup(collo/apps);
I'd like to know how and where the "collo/apps" is registered.
Any example on how and where to register?
Thanks,
Suresh Selvaraj
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before you can "look up" an object, you must first bind the object to a context.
MyDataSource dataSource = new MyDataSource();
Contex c = new InitialContext();
context.bind( "collo/apps", dataSource);
In the above lines, we created a data source, which represents your connection pool, then we created an IntitialContext so we could "bind" the object to an alias -- in this case "collo/apps" -- using JNDI.
The data source is now available to anyone, even applications running on remote machines. It should matter to you "where" the object is stored, because it could be stored on a remote machine.
Hope that helps...
SAF
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is actually better that you do this declaratively using the tool provided by your vendor rather than programmatically. For example with iPlanet, you can use "dsreg" to register a datasource. This way it is much easier to specify the driver details, max number of connections, etc.
Unless there is a strong reason to do it programmatically, this is the preferred way of registering a datasource.

[This message has been edited by Naveen Kuppili (edited November 27, 2001).]
 
Suresh Selvaraj
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks SAF and Naveen.
reply
    Bookmark Topic Watch Topic
  • New Topic