i am using the JBOss 2.2.4 integrated with catalina server.
I have set the datasource in the jboss_home\conf\catalina\jboss.jcml file as given below.
<mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
<attribute name="Drivers">oracle.jdbc.driver.OracleDriver</attribute>
</mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=OracleDBPool">
<attribute name="PoolName">OracleDBPool</attribute>
<attribute name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="Properties"></attribute>
<attribute name="URL">jdbc:oracle:thin:@oraserver:1521:coutts</attribute>
<attribute name="GCMinIdleTime">1200000</attribute>
<attribute name="JDBCUser">eplus</attribute>
<attribute name="MaxSize">10</attribute>
<attribute name="Password">eplus</attribute>
<attribute name="GCEnabled">false</attribute>
<attribute name="InvalidateOnError">false</attribute>
<attribute name="TimestampUsed">false</attribute>
<attribute name="Blocking">true</attribute>
<attribute name="GCInterval">120000</attribute>
<attribute name="IdleTimeout">1800000</attribute>
<attribute name="IdleTimeoutEnabled">false</attribute>
<attribute name="LoggingEnabled">false</attribute>
<attribute name="MaxIdleTimeoutPercent">1.0</attribute>
<attribute name="MinSize">0</attribute>
</mbean>
I want to lookup the above datasource in my java client code
as given below:
public static void main(String[] args)
{
try
{
//Sybase jconnect driver
Properties env=new Properties();
env.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url","jnp://localhost:1099");
env.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext namingContext = new InitialContext(env);
Object obj=namingContext.lookup("java:/OracleDS");
// DataSource ds = (DataSource)obj;
System.out.println("--Driver load driver--"+obj);
}catch(Exception e){
System.out.println("No DataSource to look up-->"+e.getMessage());
e.printStackTrace();
}//end of catch
System.out.println("---Hello World!---");
}//end of main
But it gives me name not bound and unable to lookup.
Can anybody help me on this problem.
Thanks in advance,
REGARDS,
Jignesh Shah
-
DataSource lookup in Client Code in JBOSS 2.2.4 (3 messages)
- Posted by: Jignesh Shah
- Posted on: February 05 2002 01:23 EST
Threaded Messages (3)
- DataSource lookup in Client Code in JBOSS 2.2.4 by Anil Kumar T on February 05 2002 09:18 EST
- DataSource lookup in Client Code in JBOSS 2.2.4 by Jason McKerr on February 05 2002 11:12 EST
- datasource lookup problem from client code explanation by Krasimir Chobantonov on April 26 2004 10:53 EDT
-
DataSource lookup in Client Code in JBOSS 2.2.4[ Go to top ]
- Posted by: Anil Kumar T
- Posted on: February 05 2002 09:18 EST
- in response to Jignesh Shah
Hi,
I dont think that is possible. The (DB)connections can be used only by the beans, but not by the clients. This is as per my knowledge. If it is possible in any server pl. le t me know.
thanks
Anil. -
DataSource lookup in Client Code in JBOSS 2.2.4[ Go to top ]
- Posted by: Jason McKerr
- Posted on: February 05 2002 11:12 EST
- in response to Anil Kumar T
actually, I did it once with tomcat32x and jboss using minerva. So I know that it's possible, but for the life of me I can't find the code I wrote.
Sorry that's not more helpful. -
datasource lookup problem from client code explanation[ Go to top ]
- Posted by: Krasimir Chobantonov
- Posted on: April 26 2004 10:53 EDT
- in response to Jignesh Shah
The main problem about applied code for accessing JNDI tree from client code i that client what to access to java:/ subtree which in my opinion can only be accessed from some JVM machine e.g. client code and jboss must be at the same jvm