I have a problem with MySQL and Postgresql9.2 this is the problem :
org.apache.lucene.store.jdbc.JdbcStoreException: Failed to execute sql [ins
I have created my own JdbcDirectory implementation, though it would rely on JEE6 to take advantage of the @Singleton
annotation. The code itself isn't too trivial to paste into a StackOverflow post and it still has a few limitations. Key part being you cannot do multiple operations on a single transaction using multiple threads because of the database locking semantics.
https://github.com/trajano/doxdb/tree/jdbc-directory-example/doxdb-ejb/src/main/java/net/trajano/doxdb/search/lucene
Looking at your implementation, it seems like you're also keeping the deleted "files" probably because it would have less fragmentation on the database store, whereas mine I had removed the record itself.
I have tagged a version that I am working with which seems stable enough for my test loads. Feel free to make comments or suggestions on it.
Compass is defunct, and I believe the last version of Lucene supported by it, explicitly, is 2.4.1.
I'd recommend you either upgrade to ElasticSearch, or downgrade Lucene.
You could also take a look at this blog post: "Create Lucene Index in database using JdbcDirectory", which attempts to create a version of JdbcDirectory compatible with Lucene 3.6. It would likely be much better to avoid JdbcDirectory
all together.