====== HANA Proxy ======
The HANA Proxy is needed if you want the app to make direct database connections to HANA. For example, if you use HANA on-premises or in a private cloud and you want the app to connect to the [[Management Database]] that you created on the HANA server.
**WARNING: The communication between the Android App and HANA Proxy is NOT encrypted. You should only be using it within an internal network, or through a VPN tunnel that encrypts all traffic.**
The Proxy is a very small Java program with an accompanying systemd service unit to allow for easy installation as a service on a GNU/Linux distribution. Typically it is installed on the same server as HANA.
===== Download & Install =====
Open a console to the HANA server and log in as the ''root'' user. (If you cannot log in as root directly, you can use the commands ''su -'' or ''sudo -i'' to switch to the root user before entering the commands below.)
Then download and unpack the hanaproxy tarball within the ''/root'' directory, create a symlink to the unpacked version, and install the systemd service:
version=1.7.0 # Don't forget to set this variable! It's used in the following commands.
cd /root
wget https://docs.cobisoft.de/wiki/_media/cobi.wms/hanaproxy-$version.tar
tar -xf hanaproxy-$version.tar
ln -s hanaproxy-$version hanaproxy
systemctl enable /root/hanaproxy/hanaproxy.service
systemctl start hanaproxy
The ''systemctl enable'' command makes sure that the service will be started on a reboot, and the ''systemctl start'' command starts it right now. You can check its status with the following command to make sure it started properly:
systemctl status hanaproxy
The output should say ''active (running)'' in green text.
===== Control / Monitor =====
You can start/stop/restart the service or check its current status with ''systemctl'':
systemctl start hanaproxy
systemctl stop hanaproxy
systemctl restart hanaproxy
systemctl status hanaproxy
Refer to the documentation of systemd/systemctl for more details.
===== Update =====
To update, unpack the newest version, update the symlink, and restart the proxy.
version=1.7.0
cd /root
wget https://docs.cobisoft.de/wiki/_media/cobi.wms/hanaproxy-$version.tar
tar -xf hanaproxy-$version.tar
rm hanaproxy
ln -s hanaproxy-$version hanaproxy
systemctl daemon-reload
systemctl restart hanaproxy
===== Troubleshooting =====
If you suspect that HANA Proxy may not be working properly even though it is running, you can test a few things. Note that some of these instructions are quite technical and require some IT knowledge.
==== TCP Port Probing ====
First of all, test if HANA Proxy is reachable from another machine. Let's say the IP Address of the HANA server is ''192.168.16.30''. The port used by HANA Proxy by default is ''30075''. Using [[https://nmap.org/|Nmap]], we can try:
nmap 192.168.16.30 -p 30075
On MS Windows, you could also use ''Test-NetConnection'' aka ''tnc'' instead of Nmap:
tnc 192.168.16.30 -Port 30075
If the port doesn't seem open, a firewall could be blocking the connection.
==== Test Query ====
Once you've made sure that the port itself is reachable, you can test if HANA Proxy can execute queries. This can be done with a ''netcat''-style program. If you have Nmap installed, you should have the ''ncat'' command. Otherwise, if you're on a GNU/Linux distro, you should have an ''nc'' command that is capable enough.
**Note:** It's important that the ''netcat'' implementation you're using executes a TCP shutdown command after it's done sending data. The ''nc'' command which is available on SuSE Linux Enterprise Server by default doesn't do this, unless you provide the ''-N'' command-line switch.
First, copy the following HANA Proxy command into a text file, let's say ''hptest.json'', with the correct password in place of "secret":
{ "host": "localhost"
, "port": "30015"
, "user": "SYSTEM"
, "password": "secret"
, "schema": "SBOCOMMON"
, "query": "select * from srgc"
}
The host can be "localhost" when the HANA Proxy is running on the same server as the HANA database; otherwise, it will have to be the IP address or hostname of the HANA server. Port ''30015'' is default for HANA. Note that this example queries ''SBOCOMMON'' for testing purposes; COBI.wms never actually queries the ''SBOCOMMON'' database.
Now you can send the command to HANA Proxy with the following command, assuming that ''192.168.16.30'' is the IP address of the server on which HANA Proxy is installed:
ncat 192.168.16.30 30075 < hptest.json
Alternatively, if you're running this command directly on the SLES/HANA server, and using the default ''nc'' tool found on it, you can run this command instead:
nc -N localhost 30075 < hptest.json
When you execute the command, the results of the query (or at least an error message) should be returned in JSON format.