Don't know if this will work on Linux as I've never played with ODBC on that platform, but I would imagine that it would be the same.
In Windows, create a test DSN using the Data Sources applet in the control panel. Set this test DSN to use the type of database driver you wish to support. When you are finished, take a look at the DSN file using Notepad. You should be able to create this sort of file on the fly, save it, and then use it to connect.
Disclaimer: I've never actually tried this trick but it seems like it should work. DSN files are really ODBC connection strings broken down into separate fields.