-
1. Re: How To get the Context for DataSource ?
jmoring Oct 25, 2002 10:28 AM (in response to pkondaka)Assuming you have setup the datasource source correctly, the following should work:
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:/MYDB");
HTH -
2. Re: How To get the Context for DataSource ?
pkondaka Oct 25, 2002 10:55 AM (in response to pkondaka)Thanks for your response.
Now it is giving different error. it is saying not able to find my Datasource. I pasted my oracle-service.xml which is in /default/deploy dir of Jboss
**************** oracle-service.xml ****************
<!-- ==================================================================== -->
<!-- New ConnectionManager setup for default hsql dbs -->
<!-- Build jmx-api (build/build.sh all) and view for config documentation -->
<!-- ==================================================================== -->
<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--embedded mbean-->
CMISDS
<config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin:@cmisdb.cmisdev.org:1521:DEVORA1</config-property>
<config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
<config-property name="UserName" type="java.lang.String">cmis</config-property>
<config-property name="Password" type="java.lang.String">cmis001</config-property>
<depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
<depends optional-attribute-name="ManagedConnectionPool">
<!--embedded mbean-->
0
50
5000
15
ByContainer
<depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
<depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager
java:/TransactionManager
<!--make the rar deploy! hack till better deployment-->
jboss.jca:service=RARDeployer
********************** end of oracle-service.xml **********
PS: I have classes12.jar under lib dir, which is in path
can please tell what could be the problem
Thanks
Praveen -
3. Re: How To get the Context for DataSource ?
tdang Oct 25, 2002 12:33 PM (in response to pkondaka)You can look up the correct name of your datasource under service=JNDIView from http://localhost:8082 (JBoss 3.0) or for Jboss3.0.1 http://localhost:8080/jmx-console.
Hope it helps. -
4. Re: How To get the Context for DataSource ?
dkato Oct 25, 2002 2:28 PM (in response to pkondaka)try putting the JNDIName in your connection like this:
DataSource ds = (DataSource) ic.lookup("java:/CMISDS");