-
1. Re: My Problem of Using Oracle as DataSource
mharnvi Aug 14, 2003 3:57 AM (in response to sakyamuni)Try
initialContext.lookup("java:/OracleDS"); -
2. Re: My Problem of Using Oracle as DataSource
debbie Aug 14, 2003 4:09 AM (in response to sakyamuni)Hi,
i'm a newbie and for the couple of days i too was struggling with same prob as the one you've mentioned. Well, i've finally found a way out.
use :
1. DataSource ds = (DataSource) initialContext.lookup("java:/OracleDS");
2. change ur ejb-jar.xml file to include:
<resource-ref>
<res-ref-name>java:/OracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
3. change ur jboss.xml file to include:
<resource-ref>
<res-ref-name>java:/OracleDS</res-ref-name>
<res-jndi-name>OracleDS</res-jndi-name>
</resource-ref>
4. Also drop the classes12.jar into the deploy directory
I don't whether this is the most elegant solution around but atleast it works.
- debbie -
3. Re: My Problem of Using Oracle as DataSource
sakyamuni Aug 14, 2003 7:15 AM (in response to sakyamuni)thanks, but I don't use Ejb to connect the DataSource, I just want to use an application to get this connection, How can I do this?
In JNDIView, I found "OracleDS" was in java:namespace(not in Global JNDI NameSpcace), my another question is: how Can I put "OracleDS" in Global JNDI NameSpace(not namespace)? -
4. Re: My Problem of Using Oracle as DataSource
javierdajabon Aug 14, 2003 9:22 AM (in response to sakyamuni)Sakyamuni,
It seems like what you are trying to do is to get a reference to that datasource from 'outside' of JBoss or on a different JVM (I believe that is the proper terminology). That is not possible. You could only get a reference to that datasource from an EJB,JSP,Servlet,etc. that has been deployed on JBoss.
Anyone, please correct me if I am wrong.
Javier -
5. Re: My Problem of Using Oracle as DataSource
divine_comedy Aug 14, 2003 10:54 AM (in response to sakyamuni)You can't get a DataSource from a different VM.
-
6. Re: My Problem of Using Oracle as DataSource
sakyamuni Aug 14, 2003 7:14 PM (in response to sakyamuni)Now I get the answer of my question from you, thank you all. I can use the connection pool in my Ejb, not an application, and I try to return the connection to my client , the JVM tell me that this connection must be Serializable.
-
7. Re: My Problem of Using Oracle as DataSource
divine_comedy Aug 15, 2003 9:27 AM (in response to sakyamuni)I believe it's also not possible to return the connection to a different VM. Returning DataSource + Connection to a different VM is not good practice IMHO. What you should probably do is set up a DataSource on the client side. May I know the reason why you would want to return a connection to the client ? If you need to call a Statement ( Prepared, Callable, etc ) maybe you should delegate the call to a SessionBean or something.