1. If you're still running this via Java, then you still don't really know where the time is being spent. Your database will have a SQL shell interface e.g. SQL*Plus for Oracle, mysql for MySQL, psql for PostgreSQL, and so on. You should run your SQL in there first, so you can be sure any problems are due to SQL only.
2. Check how fast the query runs in your SQL shell - limit it to say 100 or 1000 rows if necessary. As Martin says, the LIKE clause is certainly slowing it down. Try using an "=" comparison with a fixed value that you know is in the database, just for testing it. Then do what you can to optimise the query performance e.g. if you're on Oracle you might be able to use
text indexing. But LIKE '%x%' is always going to have do a lot of work, so maybe you need to think of a different way to find/organise your data e.g. store keywords separately and search those.
3. Check how fast the INSERT runs in your SQL shell. Hard-code the values for testing initially. Put e.g. 20 or 50 INSERTs into a SQL script file and run that via your SQL interpreter to make sure the INSERT is not the slow bit. If it is slow, talk to your DBA e.g. about indexing or tablespace allocation.
4. Most databases allow you to do INSERT INTO .... SELECT... in a single SQL statement as I described previously. This is the quickest way to do this kind of thing, because everything runs in one place at one time. In your example, there is no need to fetch records individually out of the database into Java across the network, only to write them back to the database individually, because you are not doing anything with the data inside Java anyway. You're just wasting resources. Use the INSERT...SELECT with your optimised query, but try it in your SQL shell first.
5. Learn how to use your SQL shell when you are developing SQL. That's what it's there for.
6. Take a piece of paper and write the following on it:
"Java is not a database programming language.
SQL is a database programming language.
Use the right tools for the job."
7. Pin the piece of paper above your desk so you and your colleagues can see it.
Good luck.