Hi, I think that, there is a bug in JDBStoreFactory: when I open a store
with:
Store store=factory.open("store");

I receive an SQLException : Exception while creating database

I move the connection.commit(); from  JDBStoreFactory line 62 and it work...

There is the source  code of the function:

 public synchronized Store open(String name) throws IOException {
       if (adapter == null) {
           Connection connection = null;
           try {
               connection = getDataSource().getConnection();
               adapter = JDBCAdapterFactory.getAdapter(connection);
               if (statements == null) {
                   statements = new Statements();
                   statements.setStoreTableName(tableName);
               }
               adapter.setStatements(statements);
               if (createDataBase) {
                   adapter.doCreateTables(connection);
                   if(!connection.getAutoCommit())
                       connection.commit();
               }
                connection.commit();
           } catch (SQLException e) {
               throw (IOException) new IOException("Exception while
creating database").initCause(e);
           } finally {
               if (connection != null) {
                   try {
                       connection.close();
                   } catch (Exception e) {
                   }
               }
           }
       }
       JdbcStore store = stores.get(name);
       if (store == null) {
           store = new JdbcStore(this, name);
           stores.put(name, store);
       }
       return store;
   }


Thanks.

Reply via email to