[jboss-user] [JCA/JBoss] - Re: Can't connect to global namespace datasource from servle
wmprice
do-not-reply at jboss.com
Sat Jul 29 11:11:15 EDT 2006
The local java namespace is used for ApplicationComponents (ie Servlets, EJB's) residing in the same application server. It is known as the ENC (environment naming context).
anonymous wrote :
| - If it is local then can servlets on other servers access it?
|
No.Using a datasource outside of the local container is discouraged. It was put in place solely for TCK compatiblity. From the Wiki:
anonymous wrote :
| Note: JBoss does not recommend using this feature on a production environment. It requires accessing a connection pool remotely and this is an anti-pattern as connections are not serializable. Besides, transaction propagation is not supported and it could lead to connection leaks if the remote clients are unreliable (i.e crashes, network failure). If you do need to access a datasource remotely, JBoss recommends accessing it via a remote session bean facade.
|
anonymous wrote :
| What if it is a clustered environment?
|
Datasources are non-clusterable. Each datasource is particular to the node on which it resides.
anonymous wrote :
| - If that tag is present then I can access the DS using java:/jdbc/MySqlDS, not using java:/comp/env/jdbc/MySqlDS.
|
You could, but this would defeat the purpose of using an resource-ref. A resource-ref is a logical binding of a resource-ref name to an actual JNDI name. You could very well lookup the DataSource directly from JNDI, but if the JNDI name were to change, your code would have to change. The resource-ref shields you 'hard-coding' the JNDI name in your application.
This is the purpose of the java:comp/env namespace. Basically it's a read-only JNDI namespace reserved for application components to store references to J2EE resources.
anonymous wrote :
| - Are these the only files I need to modify to make the DS available?
|
Yes.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961686#3961686
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961686
More information about the jboss-user
mailing list