-
1. Re: How to create Connection object without using JNDI?
clebert.suconic Jul 30, 2007 1:38 PM (in response to linnuxxy)JBossConnectionFactory needs a delegate on the server, and there is one ID that needs to be references, hence it's required a JNDI.
Maybe we could change this to be something similar, but at this point JNDI is required. -
2. Re: How to create Connection object without using JNDI?
linnuxxy Jul 30, 2007 1:58 PM (in response to linnuxxy)All what I need to provide a single file for configuration...
so I want provide the server url, user name and password from my code... and its ok to use the JNDI from there! -
3. Re: How to create Connection object without using JNDI?
clebert.suconic Jul 30, 2007 3:27 PM (in response to linnuxxy)I'm not sure I understand what you mean...
If you can use the JNDI... you can just wrap this code somehwere, right? -
4. Re: How to create Connection object without using JNDI?
linnuxxy Jul 30, 2007 3:32 PM (in response to linnuxxy)I'm sorry for not being clear...
Lets simplify the question...
I need to hard-code the server url in my code... rather to use jndi.properties file...
is that possible? -
5. Re: How to create Connection object without using JNDI?
linnuxxy Jul 30, 2007 3:42 PM (in response to linnuxxy)Thats what I meant:
Properties h = new Properties(); h.put( "java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); h.put( "java.naming.provider.url","jnp://localhost:1099"); h.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); InitialContext ctx = new InitialContext(h);
I found it in here
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=114325
Thanks for Helping :) -
6. Re: How to create Connection object without using JNDI?
clebert.suconic Jul 30, 2007 3:44 PM (in response to linnuxxy)Ahhh... now I understand your question:
This is something you can easily do in JNDI. You could create a method like this. the returned Context will be bound to the host you pass as a parameter:// the default method protected Context createContext() throws Exception { return createContext("jnp://localhost:1099"); } protected Context createContext(String host) throws Exception { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(Context.PROVIDER_URL, host); props.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); return new InitialContext(props); }
-
7. Re: How to create Connection object without using JNDI?
clebert.suconic Jul 30, 2007 3:45 PM (in response to linnuxxy)Thanks for Helping :)
No problem!