[jboss-user] [JCA/JBoss] - How to name my JNDI(progress Connection pool) and call it?

muddu_shafi do-not-reply at jboss.com
Tue Oct 7 12:34:14 EDT 2008


 I want to setup connection pooling in JBossAS for Progress database.
 I am not able to acess this JNDI? can anybody point out he problem in my code or in my xml file?

Are there any good practices that should be followed in 
    1) naming the XML file, and how does jboss locate particular JNDI
    2) how to name the <jndi-name> in the XML file
     3) how to lookup the jndi using java code?
        I got confused seeing various codes
             one says use "java:comp/name"
             other says "java:name"
  Seeing at my code can anybody explain how should I call the jndi?


I have a web-ds.xml file  deployed in server/all/deploy 

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!--  JBoss Server Configuration                                           -->
<!-- $Id: qadWeb-ds.xml 63175 2007-05-21 16:26:06Z rrajesh $ -->
<!--  Datasource config for Progress 9.1                                  -->




      <!-- The maximum connections in a pool/sub-pool -->

<!-- sql to call on an existing pooled connection when it is obtained from pool--> 
     <check-valid-connection-sql>SELECT COUNT(1) FROM pub.zzad_ctrl</check-valid-connection-sql>

<!-- HSQL DB benefits from prepared statement caching -->

  <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
      <type-mapping>PostgreSQL 7.2</type-mapping>

And the code to acess it
private Connection connectToDatabase(String name) throws ErpProxyDaoException, SQLException{
Connection con=null;
Context ctx = null;
DataSource ds = null;
logger.info("before loading the datasource");
logger.info("the database I'm connecting to is :" + name);
ctx = new InitialContext();
 ds = (DataSource) ctx.lookup("java:/" + name);
logger.info("After loading the datasource: " + ds);
}catch(Exception e){
throw new ErpProxyDaoException("to throw NamingException -- ", e);
return con;

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180828#4180828

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4180828

More information about the jboss-user mailing list