B4J Question jRDC to mariadb connection problem

John Naylor

Active Member
Licensed User
Longtime User
Hi all - I'm tearing what's left of my hair out here.

I have a wampserver set up and can happily connect to a database when using the following in the config.properties file of jRDC (Mariadb 10.3.12 and java version 1.8.0_191)

B4X:
DriverClass=org.mariadb.jdbc.Driver
JdbcUrl=jdbc:mariadb://localhost/STARDB?characterEncoding=utf8
User=root
Password=

and with

[CODE}#AdditionalJar: mariadb-java-client-2.4.0
[/CODE]

in main. As expected I get the correct response when runing localhost:17178/test in a browser and my b4a project can load tables perfectly.

I added a user with all priveleges

User - MyUserName, Host - % , Password - MyPassword, ALL PRIVILEGES, Grant -Yes

Changing nothing but

B4X:
User=MyUserName
Password=MyPassword


I get 'Error fetching connection' when trying the test.

In the jRDC log window I see 'java.sql.SQLInvalidAuthorizationSpecException: Access denied for user 'MyUserName@%'@'localhost' (using password: YES)'

Have I missed something in the jRDC settings that I need to tweak or is this purely something to do with how my database user is set up (I suspect it is but have no idea what I'm doing wrong)? Any help would be very much appreciated.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I get 'Error fetching connection' when trying the test.
?? What do you mean by saying trying the test?

The link you can use in a browser is not a RDC Endpoint.
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
?? What do you mean by saying trying the test?

The link you can use in a browser is not a RDC Endpoint.

WHen I use localhost:17178/test in my browser with root and no password I get

RemoteServer is running (02/07/2019 16:15:11)
Connection successful.

but when I change the username settings and do the same localhost:17178/test in my browser I get

RemoteServer is running (02/07/2019 16:17:47)
Error fetching connection.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
It seems you have some problem with the privileges, instead with jRDC2. Can you connect from another PC with phpMyAdmin and "MyUserName" and "password"?

You're missing the port number too in: (localhost:3306)?
JdbcUrl=jdbc:mariadb://localhost/STARDB?characterEncoding=utf8
but anyway you say it works for you before this
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
I just added the port number but got the same results - it works with root and no password but fails with a username & password.

When attempting to connect from anoher PC I get an error that I don't have permission to access /phpmyadmin
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Are you adding @% to the end of your username?
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
Are you adding @% to the end of your username?
Hi Oliver I have tried with & without but I'm getting the same result.

I'm getting more convinced it's something to do with priviliges but as far as I can see the user has all priviliges set - I tried running it on my VMS with the same results (accounts on that were created manually rather than imported from my local database so I'm sure I'm doing something wrong along the line somewhere).
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
Ok I seem to have sorted it at last!

I set up a new user with all privileges and a nice long password - user name Sausage, PW - MyNiceLongPasswordThatNobodyIsGoingToGuess - I fed in the name & PW to the config.properties file (without the @%) and it worked a treat. I did however notice one subtle difference between the working account and the one that fails.

I made yet another account, Bacon - and added in the difference and low and behold Bacon failed.

The difference was so simple and was in the password. The accounts that failed have special characters in their passwords. The working account uses just regular alphabet (upper and lower case) and numbers.

Thank you so much to everyone that has dropped in to help out!
 
Upvote 0
Top