You don't want to batch process you want to process by partition:
ForeachParition will allow you to create several closers to write the data into your [unsupported database]. You will need to initiate the database connection internally to the ForeachPartition code block so that it's creating the connection inside each executor.
(code inside the ForeachPartition codeblock is run on the executors not the driver. This will get around trying to initiate a connection on your driver and then shipping that live connection to all of your executors. --> serialization error you keep getting. )
There are lots of good resources out there that help explain closures and what they mean. But if you just want to learn it in depth just initiate the database connection inside the ForeachPartition code block.