Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNDI Datasource HOW-TO JBoss

843836Feb 28 2005 — edited Mar 3 2005
Hi,
If I am using the follwoing lines to connect to the database in my jsp
Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
then, where does the following lines go
<Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource" /> 
<ResourceParams name="jdbc/myoracle">
	 <parameter>
	  	<name>factory</name> 
	  	<value>org.apache.commons.dbcp.BasicDataSourceFactory</value> 
	 </parameter>
	 <parameter>
	  	<name>driverClassName</name> 
	  	<value>oracle.jdbc.driver.OracleDriver</value> 
	  	</parameter>
	 <parameter>
	  	<name>url</name> 
	  	<value>jdbc:oracle:thin:@localhost:1521:bidla2</value> 
	 </parameter>
	 <parameter>
	  	<name>username</name> 
	  	<value>a</value> 
	 </parameter>
	 <parameter>
	  	<name>password</name> 
	  	<value>b</value> 
	 </parameter>
</ResourceParams>
If it goes into my application.xml, then what should be the structure of my application.xml be ?? My application.xml already has the following lines:
<application>
	<display-name>Bidla</display-name>
	<module>
	<web>
		<web-uri>Bidla.war</web-uri>
		<context-root>/Bidla</context-root>
	</web>
	</module>	
</application>
I am using JBoss as my server. Please help. Thanks !
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2005
Added on Feb 28 2005
8 comments
481 views