Hi,

On Feb 5, 2014, at 5:59 AM, jcat <j...@nysasounds.co.uk> wrote:

> Apologies for the delayed response, been off grid :)

No worries.

>> I'm not sure why you're having connection error issues. Does this happen 
>> every time you execute the upgrade tools ?
> 
> Seems to.

OK!

> Does that suggest the DB connection is partially successful then?
> How else does it to do any of the interfaces?

Actually, I saw a similar thing before, so looking carefully, the problem is 
not related with connection to the DB, is related with executing the query or 
processing its results:

> *  Connecting to jdbc:postgresql://localhost:5432/opennms 
> Error: can't retrieve data from the OpenNMS Database because null *

Here is the related code from 
org.opennms.upgrade.implementations.SnmpInterfaceRrdMigratorOnline:

    protected List<SnmpInterfaceUpgrade> getInterfacesToMerge() throws 
OnmsUpgradeException {
        List<SnmpInterfaceUpgrade> interfacesToMerge = new 
ArrayList<SnmpInterfaceUpgrade>();
        Connection conn = getDbConnection();
        final DBUtils db = new DBUtils(getClass());
        db.watch(conn);
        try {
            Statement st = conn.createStatement();
            db.watch(st);
            String query = "SELECT n.nodeid, n.foreignsource, n.foreignid, 
i.snmpifdescr, i.snmpifname, i.snmpphysaddr from node n, snmpinterface i where 
n.nodeid = i.nodeid and i.snmpcollect in ('C','UC') and i.snmpphysaddr is not 
null";
            ResultSet rs = st.executeQuery(query);
            db.watch(rs);
            while (rs.next()) {
                SnmpInterfaceUpgrade intf = new SnmpInterfaceUpgrade(rs, 
isStoreByForeignSourceEnabled());
                if (intf.shouldMerge()) {
                    interfacesToMerge.add(intf);
                }
            }
        } catch (Exception e) {
            log("Error: can't retrieve data from the OpenNMS Database because 
%s\n", e.getMessage());
        } finally {
            db.cleanUp();
        }
        return interfacesToMerge;
    }

The SnmpInterfaceUpgrade is just a place holder to parse the ResultSet. Maybe 
I'm missing something inside that class, or something else. I'm trying to see 
if I can put some defensive code and do more validations, because the exception 
is not providing too much details (maybe adding the exception's class name 
could help).

> Unfortunately our IT policy probably doesn't allow this :(   ..but I will 
> look into it.

No worries.

If you discover something else please let me know.

Cheers,
Alejandro.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to