Android Question RDC conector not take database specified in config.properties file

bconline

Member
Licensed User
Longtime User
Hi, I've running RDC server and works fine, but the test URL always shows this

RemoteServer is running (10/25/2022 13:44:24)
Error fetching connection.

In config.properties file I've this config

#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/enviequipaje_app?characterEncoding=utf8
User=TRUE VALUE IS HIDDEN FOR SECURITY
Password=TRUE VALUE IS HIDDEN FOR SECURITY
#Java server port
ServerPort=17178

But, in server logs i've get this main error

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user '[CORRECT USER IS HIDDEN FOR SECURITY REASONS]'@'%' to database 'test'

Why?, the correct database that I wish connect is "enviequipaje_app", not "test".

The files are in a VPS server in a location outside from public_html, thats show this image

1666698646020.png

Thanks in advance for help.
 
Solution
It's like you read another config.
1.log the config map see what it is
2. Or File.ReadMap("/var/www/vhosts/enviequipaje.com", "config.properties")

OliverA

Expert
Licensed User
Longtime User
Please make sure you are running the correct .jar file. Every time you change config.properties (by default), you must recompile the source and re-deploy the resulting .jar file.

Note: The above assumes that you are using the default jRDC2 source, not a modified version that allows changes to config.properties at runtime.
 
Upvote 0

bconline

Member
Licensed User
Longtime User
Hi OliverA, thanks for answer.

No need recompile jar file. The compiled Jar file takes configuration from a external config.properties in Files folder in the server. This allow you modify the config.properties file as you need, for example, add more sql queries as needed. In the project, it's clear that the compiled jar file takes this file from the external directory.

For example, if I modify the user (ex: XXXUSER) in config.properties file in the Files folder, the error changes and says 'XXXUSER@%' denied to use database 'test'. Is the evidence that the configuration takes from this file.

B4X:
Private Sub LoadConfigMap As Map
    Return File.ReadMap(File.DirAssets, "config.properties")
End Sub
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
File.DirAssets is not an external directory!!!! Therfore you are always reading the config.properties file that is compiled into the application. Change it to File.DirApp and you can place it in the same location as the .jar file.
 
Upvote 0

bconline

Member
Licensed User
Longtime User
I get now this error

java.io.FileNotFoundException: /root/config.properties (No such file or directory)

And de config.properties is in same directory that jar file

1666723558739.png

i've changed that you says
1666723602019.png
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
How are you starting the jar file?
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I get now this error

java.io.FileNotFoundException: /root/config.properties (No such file or directory)

And de config.properties is in same directory that jar file

View attachment 135244
i've changed that you says
View attachment 135245
Iguess it was started up at /root
1. log(File.DirApp)
See what it is, and put config.properties there
2.Using full-path
Such as: File.ReadMap("/home/yourdir", "config.properties")
 
Upvote 0

bconline

Member
Licensed User
Longtime User
How are you starting the jar file?
With command in SSH console

/var/www/vhosts/enviequipaje.com/jre/bin/java -jar /var/www/vhosts/enviequipaje.com/jRDC.jar

jar file and config.properties file is both in "/var/www/vhosts/enviequipaje.com/" directory.

Thanks for your help.
 
Upvote 0

bconline

Member
Licensed User
Longtime User
Iguess it was started up at /root
1. log(File.DirApp)
See what it is, and put config.properties there
2.Using full-path
Such as: File.ReadMap("/home/yourdir", "config.properties")
Hi teddybear,

Is started in this directory

/var/www/vhosts/enviequipaje.com/

Thanks.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/enviequipaje_app?characterEncoding=utf8
User=TRUE VALUE IS HIDDEN FOR SECURITY
Password=TRUE VALUE IS HIDDEN FOR SECURITY
#Java server port
ServerPort=17178


com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user '[CORRECT USER IS HIDDEN FOR SECURITY REASONS]'@'%' to database 'test'

Why?, the correct database that I wish connect is "enviequipaje_app", not "test".
In your post #1, it seems you have read the config file and it is denied for user.
Could you connect to the database using mysql client tools?
 
Upvote 0

bconline

Member
Licensed User
Longtime User
In your post #1, it seems you have read the config file and it is denied for user.
Could you connect to the database using mysql client tools?
Yes, i can connect by MySql Front.

But it's not is the problem. The jRDC program try connect to database "test", this database is not accesible for anywhere. I wish connect to correct database, in this case, 'enviequipaje_app'. In the EREL tutorial for the jRDC server, indicates that "JdbcUrl" parameter in the config.properties is where database name is specified. But not working, jRDC try connect always at "test" and not "enviequipaje_app".

Thanks for answer.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
It's like you read another config.
1.log the config map see what it is
2. Or File.ReadMap("/var/www/vhosts/enviequipaje.com", "config.properties")
 
Upvote 1
Solution

bconline

Member
Licensed User
Longtime User
It's like you read another config.
1.log the config map see what it is
2. Or File.ReadMap("/var/www/vhosts/enviequipaje.com", "config.properties")
Well Done! , works, but I not understand why that not explain in EREL tutorial.

RemoteServer is running (10/26/2022 12:34:37)
Connection successful.

I try now with test with the app. Thanks TeddyBear and OliverA
 
Upvote 0

bconline

Member
Licensed User
Longtime User
Well guys, with a simple B4A app I can connect to the remote database throw the jRDC server and works fine!, thanks everyone that read this post and help me to configure the correct environment.

Cheers!!. The moderator can close this post for new replies.
 
Upvote 0
Top