Project

General

Profile

« Previous | Next » 

Revision 27536

better handling of connections and datasource

View differences:

ClaimConnector.java
53 53

  
54 54
        rs.close();
55 55
        stmt.close();
56
	con.close();
56 57

  
57 58
		return res;
58 59
	}
59 60

  
60 61
    public List<Claim> getClaimedPublications(Date from, Date to) throws SQLException {
62
	logger.info("Returning all claimed publications from " + from + " to " + to);
61 63
        Connection con = DataSourceUtils.getConnection(datasource);
62 64

  
63
        PreparedStatement stmt = con.prepareStatement("select \"resultid\", \"date\" , \"type\", \"xml\" from claims where \"agent\" != 'inference' and \"date \" >= ?::date and \"date\" <= ?::date ");
65
        PreparedStatement stmt = con.prepareStatement("select \"resultid\", \"date\" , \"type\", \"xml\" from claims where \"agent\" != 'inference' and \"date\" >= ?::date and \"date\" <= ?::date ");
64 66

  
65 67
        stmt.setDate(1, new java.sql.Date(from.getTime()));
66 68
        stmt.setDate(2, new java.sql.Date(to.getTime()));
......
74 76

  
75 77
        rs.close();
76 78
        stmt.close();
79
	con.close();
77 80

  
81
	logger.debug("number of claims: " + res.size());
82

  
78 83
        return res;
79 84
    }
80 85

  
......
88 93

  
89 94
        stmt.executeUpdate();
90 95
        stmt.close();
96
	con.close();
91 97
    }
92 98

  
93 99
    /**

Also available in: Unified diff