I'm trying to add multiple data connections to an infopath form in the codebehind. I see that I can connect to a db file , but not straight to sql server. Is this possible?
I am not sure what you mean under "data" in "data connection" connecting to an SQL Server but not to db file.
Codebehind is run in/from Infopath XML data forms created (opened, modified,saved, submitted, etc.) on the basis of (linked to) XSN form templates. The latter contain code behind to be uploaded and used in the former.
While it is possible to create, modify existing and execute data connections on the fly in code behind, it is senseless to speak about adding them to forms themselves (since the form definition and their code behind are in template) but only through changing a template and then republishing and relinking previously created XML data to a new template
And I strongly discourage you to use code behind. It is against Infopath paradigm and Sharepoint philosophy, architecture and security model of engaging the Infopath as client based and codeless approach.