B4J Question [jRDC2] Receiving error for MySQL TimeStamp field

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

whilst working on a B4J HowTo jRDC2 with MySQL running on a Raspberry Pi, experienced following error:
In the MySQL database, defined the table 'notes':
B4X:
CREATE TABLE notes (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,description VARCHAR(50),content VARCHAR(255), created TIMESTAMP DEFAULT NOW());

When running query SELECT * FROM NOTES via
B4X:
Dim cmd As DBCommand
cmd.Initialize
'Defined as sql.select=select * from notes in the jRDC2 file config.properties
cmd.Name = "select"
reqManager.ExecuteQuery(cmd, 0, Null)

The result is an error related to the timestamp field named 'created'
B4X:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>  java.lang.RuntimeException: Cannot serialize object: 2016-05-26 11:32:18.0</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.z-SNAPSHOT</a><hr/>
</body>
</html>
HTTP Job Done: DBRequest, false
Error: java.lang.RuntimeException: Cannot serialize object: 2016-05-26 11:32:18.0

No issues when running SELECT description,content FROM notes;

Find test project attached.
 

Attachments

  • RDCClient-UI.zip
    3.1 KB · Views: 232

rwblinn

Well-Known Member
Licensed User
Longtime User
Thanks for the hint. This worked - defined in jRDC config.properties:
B4X:
sql.select=SELECT id,description,content, DATE_FORMAT(created,'%e %b %Y') AS 'Created' FROM notes
 
Upvote 0
Top