Provide a URI as a parameter for an ODBC or OleDB provider connection string?
Is there any way of specifying a URI (rather than a physical path) as the "Data Source
" parameter in an OleDB connection string, or the "Dbq
" parameter in an ODBC connection string, such that the default ADO.Net providers will work with it?
I've tried file://
, and it's a no go, so I just wanted to confirm whether or not this is possible. I开发者_开发百科'm guessing not, but any confirmation or documentation links would be appreciated.
It's quite possible that I misunderstand the question, but I believe that it is not possible to do what you are asking unless the specific provider allows for that functionality. I have written parts of an ODBC driver, OLE DB provider, and an ADO.NET data provider. In all cases, my experience has been that the Data Source value is passed directly to the underlying provider/driver without any translation. In fact, in many cases the call from the application to the provider itself is pretty much a direct call without any additional layers (e.g., SqlConnection myconn = new SqlConnection( connstring );
doesn't go through any middle layer that would even have the opportunity of doing anything with the connection string. So if the provider did not recognize the URI as a valid data source, it would be an error.
So the issue as I understand it is whether or not the specification requires provider/driver developers to recognize URIs. I have read the specs quite a bit for those technologies and do not recall seeing anything that required such support. If such a specification exists, then I have some work to do :)
精彩评论