AKJammer Active Member Licensed User Longtime User Dec 12, 2022 #1 Quick question. I have a B4A application that connects to a MariaDB database. I had the connection string coded into the Process Globals sub as Private const rdcLink As String = "http://mariadb:17178/rdc" I figured with my mariadb hostname it wouldn't be a problem... It was.... When I moved everything over to a production environment, the tablets couldn't find the database. I scrambled and hard-coded the ip address as "http://192.168.1.51:17178/rdc", recompiled, redeployed to the 14 tablets and was ok, until the next time. So I'd like to be able to read a configuration file that can be edited on the tablet to change the location of the database. Would this be a KVS2 solution? Or is KVS2 not editable outside of the program. Just a text file sitting someplace? Thanks
Quick question. I have a B4A application that connects to a MariaDB database. I had the connection string coded into the Process Globals sub as Private const rdcLink As String = "http://mariadb:17178/rdc" I figured with my mariadb hostname it wouldn't be a problem... It was.... When I moved everything over to a production environment, the tablets couldn't find the database. I scrambled and hard-coded the ip address as "http://192.168.1.51:17178/rdc", recompiled, redeployed to the 14 tablets and was ok, until the next time. So I'd like to be able to read a configuration file that can be edited on the tablet to change the location of the database. Would this be a KVS2 solution? Or is KVS2 not editable outside of the program. Just a text file sitting someplace? Thanks
Erel B4X founder Staff member Licensed User Longtime User Dec 12, 2022 #2 It is actually not so simple as Android restricts access to all the shared files folders. If you have access then I would have used a simple text file. KVS is not simple to edit. One possible solution is to use ContentChooser to let the user (even if it is you) load external configuration files and then save them in XUI.DefaultFolder. Upvote 0
It is actually not so simple as Android restricts access to all the shared files folders. If you have access then I would have used a simple text file. KVS is not simple to edit. One possible solution is to use ContentChooser to let the user (even if it is you) load external configuration files and then save them in XUI.DefaultFolder.
cklester Well-Known Member Licensed User Dec 13, 2022 #3 In a text file (e.g., settings.txt) accessible (always) from your app, you can have something like: DEVDB=http://192.168.1.51:17178/rdc PRODB=http://mariadb:17178/rdc Click to expand... You might be able to use a build command to indicate which one to be used at some time. Or you can just comment out the one to be ignored. #http://192.168.1.51:17178/rdc http://mariadb:17178/rdc Click to expand... I basically do this with one of my company's apps. Of course, the only problem is if you ever lose access or change the location of the settings file! ? Upvote 0
In a text file (e.g., settings.txt) accessible (always) from your app, you can have something like: DEVDB=http://192.168.1.51:17178/rdc PRODB=http://mariadb:17178/rdc Click to expand... You might be able to use a build command to indicate which one to be used at some time. Or you can just comment out the one to be ignored. #http://192.168.1.51:17178/rdc http://mariadb:17178/rdc Click to expand... I basically do this with one of my company's apps. Of course, the only problem is if you ever lose access or change the location of the settings file! ?