If you have the notion of "data is not already in my database", then presumably some column (or set of columns) in your database table(s) should be declared unique. One approach would be to either query the database to check that the database does not already contain the data to be inserted for those columns. Another, probably better, approach is to just insert, then handle the unique constraint violation if it happens.