Zoran Knezevic - 78 - Jul 22, 2014

Hi, I have a scenario where I need to use a System DSN with OrmLite instead of a normal connection string.  I looked up basic examples of how to use this and all that I found was that the connection string should just contain “DSN=<YourDSNName>”.  A system data source can be setup in the ODBC Data Source Administrator.  (Control Panel > Administrative Tools > Data Sources (ODBC) > System DSN Tab.  I tried just passing the “DSN=<YourDSNName>” as the connection string and I just get an exception “A file activation error occurred. The physical file name ‘DSN=MYDSN’ may be incorrect. Diagnose and correct additional errors, and retry the operation.
Cannot attach the file ‘DSN=MYDSN.mdf’ as database ‘DSN=MYDSN’.”  I don’t know much about this and nothing came up when I googled DSN with Ormlite. Any ideas are appreciated.  Thanks!

DSN’s require using an OdbcConnection, currently all OrmLite DialectProvider’s like SqlServer uses the native SqlConnection. If you can add a feature request to support DSN’s on
http://servicestack.uservoice.com/forums/176786-feature-requests I can look to see if there’s an easy way to add support for it.

The unknown issue is whether there is any platform driver differences that exists between ODBC and the native ADO.NET SqlServer SqlConnection, hopefully it wont be as it would require a lot more effort to support.

Zoran Knezevic:

Thank you for looking into it.  I will try to find some workaround before requesting this feature.