This content has been marked as final.
Show 4 replies
-
1. Re: getting datasource jndi?
jaikiran Dec 29, 2008 7:15 AM (in response to ramujava)You will first have to lookup the datasource using the JNDI API. Then you can call the getConnection API on the DataSource. Just an example:
DataSource ds = (DataSource) new InitialContext().lookup("java:myDS"); ds.getConnection();
-
2. Re: getting datasource jndi?
ramujava Dec 29, 2008 8:54 PM (in response to ramujava)"jaikiran" wrote:
You will first have to lookup the datasource using the JNDI API. Then you can call the getConnection API on the DataSource. Just an example:DataSource ds = (DataSource) new InitialContext().lookup("java:myDS"); ds.getConnection();
i wrote the database connection in oracle-ds.xml file and placed in deploy folder and DataSource ds = (DataSource) new InitialContext().lookup("java:myDS");
ds.getConnection();
but i didn't get the connection what should i do? -
3. Re: getting datasource jndi?
ramujava Dec 29, 2008 8:55 PM (in response to ramujava)"jaikiran" wrote:
You will first have to lookup the datasource using the JNDI API. Then you can call the getConnection API on the DataSource. Just an example:DataSource ds = (DataSource) new InitialContext().lookup("java:myDS"); ds.getConnection();
how can i make jnidi map to datasource? -
4. Re: getting datasource jndi?
ezanih Jan 8, 2009 9:08 PM (in response to ramujava)Post your oracle-ds.xml and your code. What server are you using ? Because you may have to set some properties before context initialization. Also post your JNDIView (from the JMX Console) if you are using JBoss AS.