Question

What are the advantages and disadvantages of the C++ database libraries OTL and SOCI? In particular, what differences are relevant for my project, whose database uses SQL Server 2008?

I haven't used either before, and during my project I don't want to change the library.

Was it helpful?

Solution

A couple of years ago I compared them both and decided to go with Soci for a project using both a Sql Server ODBC and Sqlite backend. Back then, both Soci and OTL seemed actively maintained but Soci had a nicer interface. I haven't used OTL since then but I've used Soci a lot in a medium sized project.

I've had a couple of unexpected issues with Soci such as limitations on the length of strings (version 3.0 from 2008). The main problem with Soci is that it isn't very actively maintained. There were no updates between 2008 and 2011 so over the years I've had to write workarounds, fix the code myself or use experimental stuff from the repository. Because of this lack of updates, I've considered moving to OTL but haven't taken the leap yet. I do prefer the neatness of Soci over OTL but having actively maintained code is more important in the long run.

I haven't tried the new Soci release (2011-10-11) yet but I would be very happy if it solved some of my previous issues. Soci is a great db library and I would like it to receive some more love and attention.

So, in short. OTL may be a safer bet since it seems to be more frequently updated (but I haven't used it so I can't say for sure). Soci is "nicer" if your taste is like mine and it is perfectly usable. I would definately use it again for a small project but perhaps not for a big project because of the limited maintenance.

EDIT: I just tried the new Soci 3.1 release and they have fixed the issues with long strings in the odbc backend. I think I will stick with Soci for a bit longer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top