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
Suresh Selvaraj, (author of JQuiz)<br />SCJP2<br /><a href="http://www.decontconsulting.com" target="_blank" rel="nofollow">www.decontconsulting.com</a>
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
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).]
Joined: Nov 14, 2000
Thanks SAF and Naveen.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com