N
N
Nikolay Baranenko2017-01-19 00:56:57
Java
Nikolay Baranenko, 2017-01-19 00:56:57

How to properly connect to Berkeley DB in Java?

Hello.
I'm trying to write a Java client to connect to BerkeleyDB.
D:\\DataBases\\BerkeleyDB\\12cR1(12.1.6.2.23)\\bin\\ already has a saved CUSTOMERS table

try {

                EnvironmentConfig environmentConfig = new EnvironmentConfig();
                environmentConfig.setAllowCreate(true);
                File file = new File("D:\\DataBases\\BerkeleyDB\\12cR1(12.1.6.2.23)\\bin\\CUSTOMERS");
                Environment environment = new Environment(file, environmentConfig);

                DatabaseConfig databaseConfig = new DatabaseConfig();
                databaseConfig.setAllowCreate(true);
           //     databaseConfig.setDeferredWrite(true);
               databaseConfig.setTransactional(true);

                Database testDatabase = environment.openDatabase(null, "CUSTOMERS", null, databaseConfig);

   testDatabase.sync();
                testDatabase.close();

            } catch (Exception e) {
                out.println( "<h1>exception: "+e.getClass().getName() + ": " + e.getMessage()+"</h1>" );
            }

as a result I get an error on Environment environment = new Environment(file, environmentConfig);
org.apache.jasper.JasperException: An exception occurred processing JSP page /check_db/check_berkeley.jsp at line 131

128:                 EnvironmentConfig environmentConfig = new EnvironmentConfig();
129:                 environmentConfig.setAllowCreate(true);
130:                 File file = new File("D:\\DataBases\\BerkeleyDB\\12cR1(12.1.6.2.23)\\bin\\CUSTOMERS");
131:                 Environment environment = new Environment(file, environmentConfig);

Tell me what could be the problem and how to solve it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Moseychuk, 2017-01-19
@fshp

How to convert BerkeleyDB to BerkeleyDB JE?
Various formats. For some reason.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question