CloudDB- Cannot retreieve the data from database

Hi, I was making an app where user will play a game and when the game ended, It will send the score to the CloudDB database and user are able to retrieve and view those scores by going to the another screen.

I'm using Default server but when I go to the another screen to view the scores, I will get an error saying "ClourDBError: java.net.SocketTimeoutException: Read timed out" and no data will show it afterwards.

I don't know what's going on the background so I decided to setup a local redis-server and connect the server to redsmin to visualize the data transfer. And to my surprise, when I change the CloudDB properties to my redis-server, I got no error and successfully sending and retrieving the data from database and view it on the screen. So now I'm extra confuse to what am I doing wrong with the default server that causing this issue.

Here's the 2 block codes on main screen that's responsible for sending the data to CloudDB
blocks(2)

And this is whole code blocks of another screen that retrieve the data from CloudDB and sort the scores.

Thank you in advance.

I am not seeing any problems using two screens with cloudDB on the default MIT provided server. Check the cloudDB component properties on each screen to make sure they are exactly the same.

There are a few issues with your blocks that may be causing the problem, see the example blocks below for another way to do what you want (I use Hossien's Listutils extension for the sorting, and generated a random number for the time completion....). Also don't use open another screenname to open Screen1.

SCREEN1

blocks (57)

SCREEN2

You should only use the default server from MIT for testing and development, for production you should set up your own redis server.

HOWTO: Setup Redis Server with SSL for use with AI2

Oh, you will have to add some players and scores to the cloudDB to begin with because of the checks on Screen1.

Hi, sorry for the late reply. Advice you gave to me where great and I change some part of my code with what you suggested but the problem still persisted. So I was doing more testing by myself and notice that the problem occurs when the data I am sending is a decimal number (Since I am sending a time as a score). Which I found it strange that CloudDB can't handle the decimal number. But, I ended up convert the number to string before I store the value to CloudDB and doesn't have to change anywhere else because app inventor automatically convert string to number.

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