Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void AccumuloError() throws Throwable{
- String instanceName = "someInstance";
- String zooServers = "localhost";
- Instance inst = new ZooKeeperInstance(instanceName, zooServers);
- Connector connector = inst.getConnector("someUserName", "somePassword");
- CharSequence rowID = "row1";
- CharSequence colFam = "myColFam";
- CharSequence colQual = "myColQual";
- ColumnVisibility colVis = new ColumnVisibility("");
- long timestamp = System.currentTimeMillis();
- //path to 2005natav3_ei_ca.mdb
- String filePath = "PATH TO FILE";
- File file = new File(filePath);
- ByteBuffer byteBuffer = ByteBuffer.wrap(FileUtils.readFileToByteArray(file));
- Value value = new Value(byteBuffer);
- Mutation mutation = new Mutation(rowID);
- mutation.put(colFam, colQual, colVis, timestamp, value);
- BatchWriter writer = null;
- long memBuf = 1000000L;
- long timeout = 1000L;
- int numThreads = 10;
- String tableName = "someTableName";
- try {
- writer = connector.createBatchWriter(tableName, memBuf, timeout, numThreads);
- } catch (Exception e) {
- e.printStackTrace();
- }
- writer.addMutation(mutation);
- writer.flush();
- writer.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement