B4J Question Error in mysql

Pooya1

Active Member
Licensed User
Hi
My code
B4X:
Username        =    "root"
    Password        =    "1234"
    Databasename    =    "db"
  
    sql1.Initialize2("com.mysql.cj.jdbc.Driver", $"jdbc:mysql://localhost/${Databasename}?characterEncoding=utf8"$,Username,Password)
    sql1.ExecNonQuery("INSERT INTO data(sMobile,sID) VALUES('123123','434')")

Tip: when i used com.mysql.jdbc.Driver,it get error that i have to replace com.mysql.jdbc.Driver with com.mysql.cj.jdbc.Driver and after replace this driver,i dont have problem about driver

While my parameter is correct and i can connect to mysql with php
But i cannot connect to mysql with B4j

I run b4j output in VPS
My database is mariadb 5.5.56-MariaDB - MariaDB Server
connector : mysql-connector-java-8.0.11.jar

Error :
 
Last edited:

Pooya1

Active Member
Licensed User
Solved
Edit my.cnf file and add
port=3306
bind-address="0.0.0.0"
to file and restart service with systemctl restart mariadb/mysql

After run jar file again,maybe you see below error
error The server time zone value 'CEST' is unrecognized or represents more than one time zone

In this error please add
&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC to b4j driver query
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…