users@glassfish.java.net

Re: Glassfish: Unable to inject _at_Resource into ApplicationClient using ACC

From: <glassfish_at_javadesktop.org>
Date: Wed, 24 Jun 2009 12:59:56 PDT

Tim, That helps a lot. Thank you so much.

Let me ask few more questions that are in my mind:

Question 1 :

As advised, I have set APPCPATH=C:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;
Thats it, appclient started working. Even though ojdbc14.jar is in CLASSPATH earlier, it didnt work. How come?
[b]Will appclient at runtime look into APPCPATH env variable for libraries ?[/b]

Question 2:

When creating a connection pool in Glassfish, I am confused with these two options:
javax.sql.DataSource and javax.sql.ConnectionPoolDataSource.

What is the difference between javax.sql.DataSource and javax.sql.ConnectionPoolDataSource ?

I thought every implementation of javax.sql.DataSource supports connection pooling. ( Not just javax.sql.ConnectionPoolDataSource )

Also, I read somewhere that Glassfish will use ConnectionPoolDataSource regardless and expose just DataSource.

If we close the connection returned by (getConnection() of javax.sql.DataSource), wont that go back to connection pool ?

Let me put it this way :

[b]What is the necessity of having javax.sql.ConnectionPoolDataSource, when javax.sql.DataSource itself supports pooling.
[/b]Am I assuming anything? Will every app server implements DataSource such a way that is supports pooling? Yes/No ?

Question 3:

In Glassfish, as delineated above in Step 2, I have created a global JNDI name :

JNDI name = jdbc/abcd .

And in my code, I tried to inject the resource with the same name:

   [b]@Resource(name="jdbc/abcd")[/b]
    private static DataSource ds;

I assume that this will be interpreted as Environment Naming Context (ENC) name : [b]java:comp/env/jdbc/abcd[/b] .

Fortunately I think Glassfish will automatically resolve ENC name to global JNDI name if a resource with the same Global JNDI name exists.

But what if I have :

@Resource (name="Some_Portable_JNDI_Name")
DataSource ds;

And still my global JNDI name on server is jdbc/abcd.

[b]How to provide the mapping between ENC (java:comp/env/Some_Portable_JNDI_Name) and Global JNDI name (jdbc/abcd) in this case?
[/b]
I think I have to provide this mapping in Glassfish specific deployment descriptor?
May I know waht is that and how to provide mapping?
[Message sent by forum member 'arunkumark007' (arunkumark007)]

http://forums.java.net/jive/thread.jspa?messageID=352787