This is my sample code:
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUser("root");
dataSource.setPassword("ncl");
dataSource.setDatabaseName("userdb");
dataSource.setEmulateLocators(true);
try{
JdbcDirectory jdbcDir = new JdbcDirectory(dataSource, new MySQLDialect(), "tttable");
StandardAnalyzer analyzer = new StandardAnalyzer();
IndexWriter writer = new IndexWriter(jdbcDir, analyzer,false);
writer.optimize();
writer.close();
}catch(Exception e){
System.out.print(e);
}
I am stuck on this line: IndexWriter writer = new IndexWriter(jdbcDir, analyzer,false);
Every time I try to run this code, I get the following exception:
------ "org.apache.lucene.store.LockObtainFailedException: Lock timeout: PhantomReadLock [write.lock / tttable]" ------------
I can not find what is wrong with the code. Perhaps this is a compatibility problem with banks.
I cannot get an IndexWriter object.
devesh
source
share