Hi All,
I am just porting a program from Sqlite over to MySQL and I am having a few problems.
The reading of data is fine. My web server works like a dream reading from a MySQL database.
However, if I try and Insert or Update I get an error.
This code is fine with Sqlite
This is the log from UpdateRecord.
DBUtils version 1.01 (B4J version)
However with MySQL I get this
I have tried not using a fiels called views and also made sure the the views value is sent as an integer value.
Seems strange that all reading is fine but writing to the database is not.
To update values I use a Delphi program and that is fine.
I have also tested this on a MySQl and a MariaDB databse.
The jar file is.
Tom
I am just porting a program from Sqlite over to MySQL and I am having a few problems.
The reading of data is fine. My web server works like a dream reading from a MySQL database.
However, if I try and Insert or Update I get an error.
This code is fine with Sqlite
B4X:
Dim m As Map
Dim i As Int = mt.Get("views")+1
m.Initialize
m.Put("views", i )
Dim where As Map
where.Initialize
where.Put("id", Topic_ID)
DBUtils.UpdateRecord2(sql1, "topic", m, where)
This is the log from UpdateRecord.
B4X:
UpdateRecord: UPDATE [topic] SET [views]=? WHERE [id] = ? = (ArrayList) [71, 1]
DBUtils version 1.01 (B4J version)
However with MySQL I get this
B4X:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[topic] SET [views]=71 WHERE [id] = '1'' at line 1
I have tried not using a fiels called views and also made sure the the views value is sent as an integer value.
Seems strange that all reading is fine but writing to the database is not.
To update values I use a Delphi program and that is fine.
I have also tested this on a MySQl and a MariaDB databse.
The jar file is.
B4X:
#AdditionalJar: mysql-connector-java-5.1.37-bin
Tom
Last edited: