Posts

Showing posts with the label MuleSoft ESB

Mule4 - Resolving Database Date and DateTime Type Error while Inserting.

Let's see how to resolve error while inserting database date and datatime errors in Mule4 while inserting data into database. Column Declared as Date in database for the table example as follows: TRANDATE DATE DEFAULT '1970-01-01' NOT NULL, Dataweave : ( assuming the incoming  billing_date is coming as DateTime( example: "2024-02-06T11:02:05.237Z") and converting to Date in String format "yyyy-MM-dd" %dw 2.0 output application/json --- "billing_date": $.billing_date as DateTime {format: "yyyy-MM-dd'T'HH:mm:ss.SSSX"} as String {format : "yyyy-MM-dd"} , to convert RAML datetime type DB date time %dw 2.0 output application/json --- "date_updated" : $.date_updated as DateTime {         format : "yyyy-MM-dd'T'HH:mm:ss.SSSX"     } as DateTime {         format : "yyyy-MM-dd HH:mm:ss"     } error while executing :  "reason": "DB:QUERY_EXECUTION", "message&q