Mock tests, Interview questions, Tutorials and Tech news
 
 

Archive

Posts Tagged ‘jndi’

Creating a data source for tomcat

November 22nd, 2010 Vinay No comments

To create a datasource in tomcat , add this in your conf/context.xml

<Resource name=”jdbc/TestDB” auth=”Container” type=”javax.sql.DataSource”
maxActive=”100″ maxIdle=”30″ maxWait=”10000″
username=”javauser” password=”mypassword” driverClassName=”com.mysql.jdbc.Driver”
url=”jdbc:mysql://localhost:3306/javatest”/>
And if you are using Spring applicationContext.xml file, add this to applicationCOntext.xml file

<jee:jndi-lookup id=”dataSource” jndi-name=“jdbc/TestDB” />

Categories: Programming / tutorials Tags: ,

JNDI lookup on JBoss

March 11th, 2010 sadhna No comments

There is no standard way as per Java EE specs for  JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.

On specifying a Datasource’s JNDI name as ‘myDatasource’, JBoss binds as ‘java:myDatasource’. So if one want to deploy the application on Jboss application servers then can use the simplest way is here. The steps for adding and using jndi Datasource to JBOSS 4.x is as under-

  • Copy the jdbc driver to JBOSS_HOME/server/default/lib.
  • Create the jndi xml file for datasource – example ds.xml Read more…

Categories: Programming / tutorials Tags: , ,
Get Adobe Flash playerPlugin by wpburn.com wordpress themes