This content has been marked as final.
Show 6 replies
-
1. Re: isolate a datasource ( not share for all web application
jaikiran Mar 19, 2009 4:17 AM (in response to dickson1888)Once the datasource is available in the jndi i don't see a way you can isolate it from other applications.
-
2. Re: isolate a datasource ( not share for all web application
jaikiran Mar 19, 2009 4:18 AM (in response to dickson1888)"jaikiran" wrote:
Once the datasource is available in the jndi i don't see a way you can isolate it from other applications.
To make it more clear - other applications on the same server instance can use that datasource too. -
3. Re: isolate a datasource ( not share for all web application
dickson1888 May 26, 2009 12:36 AM (in response to dickson1888)share with other user.
Although the datasource is defined in global and all other applications can use it, you must define the reference(this datasource) inside the application definition (web.xml and jboss-web.xml) and then your application can call this datasource. -
4. Re: isolate a datasource ( not share for all web application
jaikiran May 26, 2009 2:37 AM (in response to dickson1888)"dickson1888" wrote:
you must define the reference(this datasource) inside the application definition (web.xml and jboss-web.xml) and then your application can call this datasource.
Its actually not a must, but is recommended. Without referencing the datasource through resource-ref in the web.xml and jboss-web.xml, you still can access the datasource through the global jndi name. -
5. Re: isolate a datasource ( not share for all web application
dickson1888 Jun 1, 2009 11:32 PM (in response to dickson1888)Thanks for jaikiran's correction.
How to call a database by global jndi name in a jsp? (coding) Thanks. -
6. Re: isolate a datasource ( not share for all web application
jaikiran Jun 2, 2009 10:23 AM (in response to dickson1888)Datasources in jboss are by default bound to java: namespace. So if you want to just use this jndi name then your jsp would look like (let's assume the datasource jndi-name is abc):
Context ctx = new InitialContext(); ctx.lookup("java:abc");
If you want to bind the datasource in global jndi namespace (i.e. make it available outside the server JVM) then you can follow these steps http://www.jboss.org/community/wiki/HowCanIAccessADataSourceFromAClient
Once you have made available the datasource globally, you can access it without the java: namespace:Context ctx = new InitialContext(); ctx.lookup("abc");