On the off chance that there's a sensible plan in there somewhere ... if I'd have to do something like this I'd look at options in this order:
For simulation:
1 - use simple boring $write to dump all the relevant data to a comma seperated file, and use your favorite database import tool or script
2 - check if there's easy to use systemverilog classes out there that already fixed the problem for you
3 - lacking 2: use DPI to wrap the most elementary database C function calls from whatever API is easiest to use for your database
For synthesis aka real actual hardware:
1 - uhm?
2 - are we sure?
3 - oh alright
4 - use simple UART or whatever connectivity is appropriate for your data rate, and do a straight up value dump again. This can be processed on the PC again like option 1) for simulation above.
5 - add an embedded linux server and okay not really.
Case in point is to always always try to shift the database heavy lifting to the PC and keep the HDL side as stupid and simple as possible. Because that way you have some time to enjoy the nice weather. Without headaches.
As for the systemverilog classes, does anyone know if there are easy to use options out there? I know I could do it with DPI-C, but that would be rather silly if there is already something out there. Right now I do such thing pretty much as I described above with $write + post processing, but it would be nice if there's something even easier.