try
{
connection = connectionPool.getConnection();
if(connection == null)
throw new DataBite("Could not get a Connection from the pool");
stmt = connection.prepareStatement(question);
int i = 1;
for (Object parameter : parameters)
{
stmt.setObject(i, parameter);
i++;
}
ResultSet rs = stmt.executeQuery();
JdbcLine line = new JdbcLine(rs);
List<T> r = new ArrayList<T>();
while(rs.next())
{
r.add(listener.listenLine(line));
}
stmt.close();
stmt = null;
try
{
connection.close();
}
catch(SQLException e)
{
connection = null;
throw e;
}
return r;
}
catch (SQLException e)
{
if(stmt != null)
try
{stmt.close();}
catch (SQLException e1)
{
}
if(connection != null)
try
{connection.close();}
catch (SQLException e1)
{
}
throw new DataBite(e);
}
}