Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

What is the ODBC DSN counterpart in .NET?

What offers ADO.NET to use instead of ODBC DSN?
Can I use some database in my app "by name", being able to set that "name" to any database?

Mikhail Andronov
Thursday, October 17, 2002

I stopped using DSN's a while ago even in classic ASP sites.

Changing the connection string in a config file seems to be just as easy as changing the database in the ODBC control panel. Global.asa in ASP, Web.config in ASP.NET.

The only drawback is deployment between dev/staging/live environments. With DSN's you can just copy everything over. With config files you have to be a little more careful.

Luke Duff
Thursday, October 17, 2002

Assuming you've downloaded the ODBC ADO.NET provider, there are several ways to specify what ODBC data source to use. The docs list them all. I use the DSN. For example, I have a connection string of the form:

"DSN=dsn-name;UID=user-id;PWD=password"

Hope that helps,

Donnie

Donnie Hale
Monday, October 21, 2002

Unless you are locked into using a data source that doesn't provide OLE DB or a native provider for .NET, you should probably at all cost avoid ODBC.  All it will do is add a couple more layers of code to run through before it reaches your database.  When going with the SQL provider for example, it is basically Your App -> SQL Provider -> Sql Server.  With ODBC it would be Your App -> ODBC Provider -> SQL ODBC Driver -> Sql Server.  Omph.

I would definitely go with a .config file, an object contructor (if in COM+) or an UDL file before going with an ODBC DSN

Philip Scott
Thursday, October 24, 2002

Tip: for a convenient list of typical ADO.NET connection strings, go to
http://www.able-consulting.com/ADO_Conn.htm

Bernard Vander Beken
Thursday, October 24, 2002

*  Recent Topics

*  Fog Creek Home