Java program to insert value in Aerospike database is not working


I have written a java program to insert an integer and a double in aerospike database. Here is the code snippet

import java.util.Random;

import com.aerospike.client.AerospikeClient;
import com.aerospike.client.Bin;
import com.aerospike.client.Key;
import com.aerospike.client.policy.WritePolicy;

public class Test{

	public static void main(String[] args){
			AerospikeClient client = new AerospikeClient("", 3000);
			for(int i=0;i<10000;i++){
				try {
					WritePolicy writePolicy =  new WritePolicy();
					Key key = new Key("test" , "myset", "mykey");
					double randomDouble = Math.random();
					Bin bin1 = new Bin("ID",i);
					Bin bin2 = new Bin("Value",randomDouble);
				} catch (Exception e) {
		catch(Exception e){

The problem is the above code snippet is neither inserting any data nor throwing any errors. Please advise. PS: I am new to aerospike



I am able execute without any modification except the hostname.

Below is the result after execution.

aql> select * from test.myset where pk='mykey'
| ID | Value               |
| 9  | 4589745104084075448 |
1 row in set (0.001 secs)


Yes even I figured that out, I was actually firing a wrong query in aql - my bad. Is there a way to read all the records of a particular set at one go?



Yes, but you need to paginate it. Else you will get timed out.

Thanks, Dhanasekaran