try { con = ds.getConnection(); String sql = "INSERT INTO ServiceSpaceEndpoints(serviceSpaceId,pipeAd) VALUES(?)"; stmt = con.prepareStatement(sql);
try { con = ds.getConnection(); String sql = "INSERT INTO ServiceSpaceEndpoints(serviceSpaceId,pipeAd) VALUES(?,?)"; stmt = con.prepareStatement(sql);
    public ServiceSpaceEndpoint addPipeAdvertisement(int serviceSpaceId, PipeAdvertisement pipeAd)        throws DAOException {        Connection con = null;            PreparedStatement stmt = null;            try {                con = ds.getConnection();                String sql = "INSERT INTO ServiceSpaceEndpoints(serviceSpaceId,pipeAd) VALUES(?)";                stmt = con.prepareStatement(sql);                ByteArrayOutputStream out = new ByteArrayOutputStream();                pipeAd.getDocument(xmlMimeMediaType).sendToStream(out);                stmt.setInt(1,serviceSpaceId);                stmt.setString(2,out.toString());                stmt.executeUpdate();                return new ServiceSpaceEndpointImpl(serviceSpaceId, pipeAd);            } catch (Exception e) {                throw new DAOException("Could not store pipe advertisement: " + e.getMessage());            }            finally {                try { if (stmt != null) stmt.close(); } catch (SQLException e) { }                try { if (con != null) con.close(); } catch (SQLException e) { }            }    }