public static synchronized Connection getConnectionFromPool() throws Exception   
    {   
        Connection newConnxn = null;   
           
        if(availableConnections.size() == 0)   
        {   
             newConnxn = getConnection();   
             usedConnections.addElement(newConnxn);   
        }   
        else   
        {   
            newConnxn = (Connection)availableConnections.lastElement();   
            availableConnections.removeElement(newConnxn);   
            usedConnections.addElement(newConnxn);               
        }           
           
        return newConnxn;   
    }