B4J Question Open config.properties from external source in JRDC2

A Z M JANNAT UL KARIM

Member
Licensed User
Hi, in somewhere on the forum I saw a way to make the config.properties file set as external so that every time I need to change, the compilation not required. Can anybody help me here. I know that it is unsafe, but it will work in local intranet. Thank you.
 

A Z M JANNAT UL KARIM

Member
Licensed User
It is not unsafe.

The code that reads the configuration file is very simple:
B4X:
'RDCConnector
Private Sub LoadConfigMap As Map
   Return File.ReadMap(File.DirAssets, "config.properties")
End Sub
You can change it to load from a different folder.

Thank you Erel. So what I understand is if I modify the line with the following line and put the config.properties with the jar file that will solve the problem.

B4X:
Return File.ReadMap(File.DirApp, "config.properties")

Also I want to change the file runtime without compiling jar file continuously. So I am activating DebugQueries = True. Hope everything will be Okay.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
excuse my ignorance, but, does it means that jRDC.jar "reads" config.properties continuosly
When DebugQueries is True (see the code in the RDCConnector class module of the jRDC2 source), then for every call to the jRDC2 server, the config.properties file is read anew. This way if you update/delete/add new SQL queries to the config.properties file, they will be effective without having to stop/start the jRDC2 server. Please note:
1) In order for this to work, your config.properties file must be located outside of the asset directory (what this thread dealt with originally).
2) This only affects the SQL statements within the config.properties file. Anything else (DriverClasss, JdbcUrl, anything that does not start with sql.) that is changed will still require a stop/start of the jRDC2 server.
 
Upvote 0
Top