Please help me, I am a newbie…..

I have a class which is looking for JNDI in Jboss, I have deployed the jar file 
for this project in Jboss deploy directory. 
Can any one explain me, where should I place my datasource xml file, i.e should 
I place it in the deploy directory itself? 
What should I name the XML files? 
Upon seeing the files I thought I should name them as 
proxy-ds.xml, proxy-backup-ds.xml, web-ds.xml.
Am I right? Or should I name it differently?

 

public enum ProxyDbMode {PRIMARY, BACKUP};
private ProxyDbMode proxyMode = ProxyDbMode.PRIMARY;

private Connection getProxyDbConnection() throws ErpProxyDaoException, 
SQLException {
                                
                Connection con;
                
                if (this.proxyMode != ProxyDbMode.PRIMARY) {
                        con = this.connectToDatabase("proxy");
                        ErpProxyProgressDAO.logger.info("Connected to proxy 
primary");
                }
                else {
                        con = this.connectToDatabase("proxy-backup");
                        ErpProxyProgressDAO.logger.info("Connected to proxy 
backup");
                }
                
                return con;
        }

        private Connection getQadWebDbConnection() throws ErpProxyDaoException, 
SQLException {
                Connection con = this.connectToDatabase("web");
                ErpProxyProgressDAO.logger.info("Connected to web db");
                return con;
                }


        private Connection connectToDatabase(String name) throws 
ErpProxyDaoException, SQLException{
                
                Context ctx = null;
                DataSource ds = null;
                try{
                        ctx = new InitialContext();
                        ds = (DataSource) ctx.lookup("java:" + name + "-ds");
                }catch(Exception e){
                        throw new ErpProxyDaoException("to throw 
NamingException -- ", e);
                }

                return ds.getConnection();
}
------------------------------------------------------------------------------------
And how should I make sure that the connection closes, when  ever I call this 
Method?

Thanks for taking time and looking at my question. Please respond......

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

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

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to