[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


Hi,

 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?


Please............ 



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                                  -->



   <local-tx-datasource>
   <jndi-name>web</jndi-name>

<connection-url>jdbc:JdbcProgress:T:qad3:15330:trnwebeb2</connection-url>
  <driver-class>com.progress.sql.jdbc.JdbcProgressDriver</driver-class>
     <user-name>xxxx</user-name>
      yyyyy

     <min-pool-size>5</min-pool-size>

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

       <idle-timeout-minutes>20</idle-timeout-minutes>
<!-- 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>
      
      <track-statements>true</track-statements>-->

<!-- HSQL DB benefits from prepared statement caching -->
      <prepared-statement-cache-size>32</prepared-statement-cache-size>

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




And the code to acess it
private Connection connectToDatabase(String name) throws ErpProxyDaoException, SQLException{
		
Connection con=null;
Context ctx = null;
DataSource ds = null;
try{
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);
con=ds.getConnection();
}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