To troubleshoot this issue, please let me know the following details. Thanks in advance！
1 Which user credentials is being used to add the data source to the gateway.
2 Who is the administrator of the machine where gateway is running.
3 Are your database and gateway installed on the same machine?
4 Is the credential has sufficient permissions to access the resources on the machine installed gateway?
In addition, please check the connection status of your data source in Manage Gateways if you are using Standard mode gateway and check the configuration in Dataset Settings page. Make sure data source used in dataset has mapped to the proper registered data source on gateway.