Android Code Snippet [B4X] Amazon DynamoDB

Amazon DynamoDB is a NoSQL database service: AWS DynamoDB

The attached project (B4J, B4A and B4I) shows how to access Amazon DynamoDB. The relevant code module is 'AWSDynamoDB'. You should first initialize the class with your credentials (put your keys in Main.Process_Globals in order to obfuscate them):
B4X:
Private DDB As AWSDynamoDB
DDB.Initialize(DynamoDBAccessKey, DynamoDBSecretAccessKey, DynamoDBRegion)

This is an example of how to perform a GetItem request:
B4X:
Wait For(DDB.GetItem(tbTable.Text, tbPartitionKey.Text, tbValue1.Text, tbSortKey.Text, tbValue2.Text)) Complete (Result As String)

Not all operations are implemented but it should be easy to add them based on the examples.

DynamoDB.png
 

Attachments

  • DynamoDB_Example.zip
    21.8 KB · Views: 251

MaaMoz

Member
Licensed User
Longtime User
Amazon DynamoDB is a NoSQL database service: AWS DynamoDB

The attached project (B4J, B4A and B4I) shows how to access Amazon DynamoDB. The relevant code module is 'AWSDynamoDB'. You should first initialize the class with your credentials (put your keys in Main.Process_Globals in order to obfuscate them):
B4X:
Private DDB As AWSDynamoDB
DDB.Initialize(DynamoDBAccessKey, DynamoDBSecretAccessKey, DynamoDBRegion)

This is an example of how to perform a GetItem request:
B4X:
Wait For(DDB.GetItem(tbTable.Text, tbPartitionKey.Text, tbValue1.Text, tbSortKey.Text, tbValue2.Text)) Complete (Result As String)

Not all operations are implemented but it should be easy to add them based on the examples.

View attachment 124092
Hello roumei

When trying to run your program, I get the following error:

[IDE message - 8:00:18]
The following libraries are missing:
encryption

Where can I find this Library?

Thank you
 

Magma

Expert
Licensed User
Longtime User
Thank you DonManfred for helping me out.

I had run several searches and, somehow, did not find it. Sorry. Grateful for your help.
Hi there...

it seems no need library, uses the API of Amazon and credentials you ve must to create.... Did you try to download the Example and run it ? ...you ll see no need to add any library.
 

DonManfred

Expert
Licensed User
Longtime User
it seems no need library, uses the API of Amazon and credentials you ve must to create.... Did you try to download the Example and run it ? ...you ll see no need to add any library.
wrong!

You are using these libraries.
Library1=b4xpages
Library2=core
Library3=encryption
Library4=okhttputils2
Library5=stringutils
Library6=byteconverter

You´ll get an error if one is missing. He has no Encrypting-Library so it results in the error he got.
 

alimanam3386

Active Member
Licensed User
Longtime User
Thanks for sharing... Whatever I think it is not a good idea to put access keys in the source code in client side of app , it should use in server side for security issues.
 
Top