-
1. Re: Using XADataSource from remote application
adrian.brock Feb 4, 2002 5:39 AM (in response to dlaidlaw)Not sure about your requirement.
If you want to use the datasource registered in JBoss,
you can get it using JNDI, just narrow it to a
DataSource.
If you are talking about embedding and starting one
in your own application this is ok too.
I'm not aware of any docs about it, but I've seen
people who say they've done it in the persistence forum.
Regards,
Adrian -
2. Re: Using XADataSource from remote application
dlaidlaw Feb 4, 2002 11:36 AM (in response to dlaidlaw)Well, my problem is that the code I want to access the DataSource object with is running in a different JVM. And the DataSource is registered in JNDI under the java: namespace. That means, I believe, that DataSource is not available to JNDI lookups from a different JVM. Correct? At least, I have been unable to lookup the java:HermesPool object (that is its name when I explore the JNDIView).
What I want is to be able to use the pool from an different JVM than the one running JBoss. My extenal application is using JBoss MBeans to provide services via JMS messaging, so I need JBoss anyway, just wanted to be able to use the pools as well.
The application I am using is a third-party thing that I cannot get to run inside the JBoss JVM. But I can add functionality to that app using plugin classes. My plugins need a JDBC pool. I can either write or copy some pooling code, but since JBoss is already running, it sure would be nice to just use it!
Thanks! -
3. Re: Using XADataSource from remote application
adrian.brock Feb 4, 2002 1:20 PM (in response to dlaidlaw)I see your problem. It is hard-wired to go into the
java namespace :-(
Regards,
Adrian -
4. Re: Using XADataSource from remote application
adrian.brock Feb 4, 2002 1:27 PM (in response to dlaidlaw)You probably wouldn't want to pull a datasource from
a pool on a different machine? It is much better to
pool it locally. Isn't that the point?
Regads,
Adrian -
5. Re: Using XADataSource from remote application
dlaidlaw Feb 4, 2002 1:46 PM (in response to dlaidlaw)> You probably wouldn't want to pull a datasource from
> a pool on a different machine? It is much better to
> pool it locally. Isn't that the point?
>
> Regads,
> Adrian
Yep. I am actually running them both on the same machine, I just can't run in the same JVM.
So I just tried making a copy of the org.jboss.jdbc.JDBCDataSourceLoader and having it bind to /jdbc/myPool. That worked OK. I can look it up, but I always return a null, no exception thrown. JNDIView says it is bound, though.
For the following the ctxProps are properties pointing to jnp://localhost:2099 (I am running JNDI on 2099).
try {
ctx = new InitialContext(ctxProps);
Object ref = ctx.lookup("/jdbc/myPool");
if (ref == null) {
System.out.println("lookup returned null");
System.exit(1);
}
...
Always prints out "lookup returned null". Weird. If I put in a name that is not bound I get a naming exception.
Note, I am not using an XA datasource, don't really need that in my app.
What I CAN do, I suppose, is write all my queries to JDBC and Entity beans and just access those from my app. That would use the pooling automagically.
Thanks for all your help on this! -
6. Re: Using XADataSource from remote application
ipozeng Feb 4, 2002 9:39 PM (in response to dlaidlaw)I donot think it is hard to export the DataSource to outside world.The apusic server can do it very well(http://www.apusic.com)!
Why does jboss register it in glaobal namespace?
Regards! -
7. Re: Using XADataSource from remote application
adrian.brock Feb 5, 2002 5:48 AM (in response to dlaidlaw)You probably want to ask in the persistence forum?
Regards,
Adrian -
8. Re: Using XADataSource from remote application
dlaidlaw Feb 5, 2002 12:00 PM (in response to dlaidlaw)>
> Why does jboss register it in glaobal namespace?
>
>
Because by default it binds to the java: namespace which is not accessible from a different JVM. The MBean that does this binding is a copy of org.jboss.jdbc.JDBCDataSourceLoader that I modified slightly to change its binding. -
9. Re: Using XADataSource from remote application
dlaidlaw Feb 5, 2002 12:01 PM (in response to dlaidlaw)> You probably want to ask in the persistence forum?
>
> Regards,
> Adrian
Done! Thanks for all your help.
-Don -
10. Re: Using XADataSource from remote application
luckystar_007 Mar 8, 2002 12:19 AM (in response to dlaidlaw)How Did you done it, would you please tell me? I am experiencing the same pain now.I will be very appreciated