Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

37
LINES

< > BotCompany Repo | #1004018 // Test Berkeley DB

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Transpiled version (477L) is out of date.

!752

lib 1004017 // Berkeley DB

import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;

import com.sleepycat.persist.EntityStore;
import com.sleepycat.persist.StoreConfig;

p {
  Environment myEnv;
  EntityStore store;
  
  bool readOnly = false;
  File envHome = mkdir(getProgramDir());
  
  print("Opening Berkely DB in " + envHome.getAbsolutePath());

  EnvironmentConfig myEnvConfig = new EnvironmentConfig();
  StoreConfig storeConfig = new StoreConfig();

  myEnvConfig.setAllowCreate(!readOnly);
  storeConfig.setAllowCreate(!readOnly);

  // Open the environment and entity store
  myEnv = new Environment(envHome, myEnvConfig);
  store = new EntityStore(myEnv, "EntityStore", storeConfig);
  
  print("Closing");
  
  if (store != null)
    store.close();
  if (myEnv != null)
    myEnv.close();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004018
Snippet name: Test Berkeley DB
Eternal ID of this version: #1004018/1
Text MD5: 1be599d2bb8be549b820f9680521a167
Author: stefan
Category: javax / databases
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-03 17:57:23
Source code size: 912 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 552 / 607
Referenced in: #1004019 - Test Berkeley DB 2 (Storing)