Check for duplicates before inserting into mySQL table

Hi!

First I would like to say I'm sory for opening new thread about this problem but I googled and also searched this site for this problem but I didn't find anything that could do job for me.
So on problem... I have two mySQL tables, T_AJPES_TR_LOG_ table(with ID,Date_import and File_import) and T_AJPES_TR table that I store data from XML files. In TR_LOG table I write filename from which I want to import file.
What I would like to do is that before I insert filename in TR_LOG, I want to check if that file wasn't imported before. If it was imported then program tries to import next file otherwise import it.

This is not entire code from program, only part where I check if file is already imported or not. Further is only XML parsing part.

edit: I tried to declare File_import as unique key but when it comes to uprs1.insertRow() then it throws duplicate error(if file was already imported).
Also tried to move uprs1 = stmt.executeQuery("SELECT * FROM dbtest.T_AJPES_TR_LOG WHERE File_import" + name) resultset after for loop and then it throws me error unknown column File_import ...

Why are you using a resultset to do this insert?
Just use an INSERT.
That's my first suggestion.

Second, the unique key is the way forward since that's what you want to do.
Loop round the file list you have doing an insert each time.
That insert will be in a try/catch block. On a failure you simply continue round the loop.

Also use a PreparedStatement rather than concatenating your inserts together.