How to create set and save or query data by java

hi all Comparison with aerospike and mysql

how to create set and save or query data by java

AerospikeClient client = new AerospikeClient("192.168.1.150", 3000);

Key key = new Key("test", "demo", "putgetkey");
Bin bin1 = new Bin("bin1", "value1");
Bin bin2 = new Bin("bin2", "value2");

// Write a record
client.put(null, key, bin1, bin2);

// Read a record
Record record = client.get(null, key);

client.close();

in this example where are database、table、column and row。

thanks!

See annotation below:

AerospikeClient client = new AerospikeClient("192.168.1.150", 3000);

// The Key object consists of "namespace", "set", and "key".
// Using similar SQL concepts: "database", "table", and "primary key".
Key key = new Key("test", "demo", "putgetkey");

// Here we are defining 2 bins (similar to columns in SQL) with names "bin1" and
// "bin2" and values "value1" and "value2".
Bin bin1 = new Bin("bin1", "value1");
Bin bin2 = new Bin("bin2", "value2");

// Write a record - similar to a "row" in SQL.
client.put(null, key, bin1, bin2);

// Read a record - similar to a "row" in SQL.
Record record = client.get(null, key);

client.close();

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.