B4J Question jrdc problem/ question with ubuntu

John Decowski

Member
Licensed User
Ok i have my ubuntu server configured with mysql and have copied all my files to the server. I have all 3 files in the same folder. jrdc.jar, config.properties and my connector jar. my question is, does the config file need to be in a particular folder? because when i launch the app, i can connect to the test server but it says error fetching connection. when i look at the runtime log screen, it displays a user name as localdb on localhost. I dont have that name configured on my config file. the user on my config file is john? was wondering if it defaulted to this localdb user if it cant find the config file?

thanks in advance
 
Last edited by a moderator:

John Decowski

Member
Licensed User
well i have figured out my own problem once again. Seems when I compiled the app I included my config file inside my "file manager" in jrdc and it has come with the jar. and it seems it cannot be modified after this state. I wonder if i can remove it and recompile and then will it default to the external version of config so at least you can edit it without having to recompile?
 

OliverA

Expert
Licensed User
Quick fix. Modify LoadConfigMap in RDCConnector module
B4X:
'Private Sub LoadConfigMap As Map
'   Return File.ReadMap(File.DirAssets, "config.properties")
'End Sub
Private Sub LoadConfigMap As Map
   If File.Exists(File.DirApp, "config.properties") = False Then
       File.Copy(File.DirAssets, "config.properties", File.DirApp, "config.properties")
   End If
   Return File.ReadMap(File.DirApp, "config.properties")
End Sub
The first time you run the server, it will copy the asset folder's config.properties file to the same location as the server jar file. After that, as long as config.properties exists at the same location as the server's jar file, it will use that config.properties file.
Additional notes:
1) You still have to restart the server in order for changes to be effective.
2) File.DirApp may not work on Windows (depending on where server jar file is located). In that case, File.DirData would be a better choice.
3) Remember, this is just a quick fix, not a comprehensive solution.
 
Top