[thelist] [.NET] Multi-Database Programming

Joshua Olson joshua at waetech.com
Mon Nov 8 16:06:20 CST 2004

> -----Original Message-----
> From: Marcus Andersson
> Sent: Monday, November 08, 2004 2:34 PM
> How about programming to interfaces and using reflection?


I did end up figuring out the problem and it used half of your suggestion.
Programming to interfaces is the key, but reflection ended up being used

Here's the code I ended up with:

Assembly asm = Assembly.LoadWithPartialName("Oracle.Database");
if (asm == null)
  throw new Exception("Oracle drivers not found.  Please ensure...");
Type t = asm.GetType("Oracle.DataAccessClient.SqlConnection");
conn = (System.Data.IDbConnection)Activator.CreateInstance(t);
conn.ConnectionString = "whatever"

I repeated the same sort of code for all the different support databases and
it worked excellent!  

Thanks all.

Joshua Olson
Web Application Engineer
WAE Tech Inc.

More information about the thelist mailing list