marcick Well-Known Member Licensed User Longtime User Jan 5, 2016 #1 I'm trying to move my code from JRDC to JRDC2 but now I get an error on the server when I use ExecuteQuery2 from the client. The line in JRDC2 that generate the error is this Code: Copy Dim data() As Byte = ser.ConvertObjectToBytes(res) And the error is: Code: Copy java.lang.RuntimeException: java.lang.RuntimeException: Cannot serialize object: 2015-12-0412:07:08.0 Any hint ?
I'm trying to move my code from JRDC to JRDC2 but now I get an error on the server when I use ExecuteQuery2 from the client. The line in JRDC2 that generate the error is this Code: Copy Dim data() As Byte = ser.ConvertObjectToBytes(res) And the error is: Code: Copy java.lang.RuntimeException: java.lang.RuntimeException: Cannot serialize object: 2015-12-0412:07:08.0 Any hint ?
B b4auser1 Well-Known Member Licensed User Longtime User Jan 5, 2016 #2 Check this: Erel said: Due to the usage of B4XSerializator with other platforms, the two types should be declared in the main module: Code: Copy Sub Process_Globals Dim reqManager As DBRequestManager Type DBResult (Tag As Object, Columns As Map, Rows As List) Type DBCommand (Name As String, Parameters() As Object) End Sub Click to expand... Upvote 0
Check this: Erel said: Due to the usage of B4XSerializator with other platforms, the two types should be declared in the main module: Code: Copy Sub Process_Globals Dim reqManager As DBRequestManager Type DBResult (Tag As Object, Columns As Map, Rows As List) Type DBCommand (Name As String, Parameters() As Object) End Sub Click to expand...
marcick Well-Known Member Licensed User Longtime User Jan 5, 2016 #3 Thank you but, yes, it is. The error appears also in the original JRDC2 source code Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 5, 2016 #4 Seems like it is failing with a date data type. What are the columns types? Upvote 0
marcick Well-Known Member Licensed User Longtime User Jan 5, 2016 #5 that error I suppose is related to a column Timestamp or DateTime (I have both types in the MySQL db) Upvote 0
that error I suppose is related to a column Timestamp or DateTime (I have both types in the MySQL db)
Erel B4X founder Staff member Licensed User Longtime User Jan 6, 2016 #6 You need to convert it to string in the query. For example: http://stackoverflow.com/questions/2392413/convert-datetime-value-into-string-in-mysql Upvote 0
You need to convert it to string in the query. For example: http://stackoverflow.com/questions/2392413/convert-datetime-value-into-string-in-mysql
marcick Well-Known Member Licensed User Longtime User Jan 6, 2016 #7 Uhmm... Not clear exactly what to do and where... Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 6, 2016 #8 Can you post the query that you are running (from the config file)? Upvote 0
marcick Well-Known Member Licensed User Longtime User Jan 6, 2016 #9 Code: Copy sql.RDC_Sync = SELECT * FROM `records` WHERE (( `Pwd` = ? OR `Pwd` = ?) AND `Index` > ? AND `Device` NOT LIKE ?) Upvote 0
Code: Copy sql.RDC_Sync = SELECT * FROM `records` WHERE (( `Pwd` = ? OR `Pwd` = ?) AND `Index` > ? AND `Device` NOT LIKE ?)
Erel B4X founder Staff member Licensed User Longtime User Jan 6, 2016 #10 You need to replace * with the column names and explicitly convert the datetime columns to a string: Code: Copy sql.RDC_Sync = SELECT col1, col2, DATE_FORMAT(col3,'%d %m %Y'), col4, DATE_FORMAT(col5,'%d %m %Y') FROM `records` ... Upvote 0
You need to replace * with the column names and explicitly convert the datetime columns to a string: Code: Copy sql.RDC_Sync = SELECT col1, col2, DATE_FORMAT(col3,'%d %m %Y'), col4, DATE_FORMAT(col5,'%d %m %Y') FROM `records` ...
marcick Well-Known Member Licensed User Longtime User Jan 6, 2016 #11 something is changing but have other errors and need to understand better tomorrow. I have a bigint(20) column also. Could it create problems in serializator ? Upvote 0
something is changing but have other errors and need to understand better tomorrow. I have a bigint(20) column also. Could it create problems in serializator ?
Erel B4X founder Staff member Licensed User Longtime User Jan 6, 2016 #12 You need to post the error messages... Upvote 0
marcick Well-Known Member Licensed User Longtime User Jan 7, 2016 #13 Solved. The problem was that using "DATE_FORMAT(sdate,'%d %m %Y')" the column name that is returned to the client is not "sdate" but "DATE_FORMAT(col3,'%d %m %Y')" .... So I have modified the query using "AS" Code: Copy DATE_FORMAT("sdate",'%d %m %Y') AS "sdate" Everything seems to works fine now. This foum is better than a school. Thanks again ! Upvote 0
Solved. The problem was that using "DATE_FORMAT(sdate,'%d %m %Y')" the column name that is returned to the client is not "sdate" but "DATE_FORMAT(col3,'%d %m %Y')" .... So I have modified the query using "AS" Code: Copy DATE_FORMAT("sdate",'%d %m %Y') AS "sdate" Everything seems to works fine now. This foum is better than a school. Thanks again !