I would like to connect to a DB2 database, specifically an iSeries version, using .Net and C# by referencing a .dll and NOT installing any software on the server. Currently we use the IBM.Data.DB2.iSeries.dll, which is installed as part of iSeries access for windows. I don't want to have to install all of that. But apparently I don't have an option because the other provider IBM.Data.DB2.dll also requires you to install software before it will work according to this over stackoverflow post: http://stackoverflow.com/questions/402484/ibm-data-db2
Is there anyway to connect from .Net c# code to DB2 by simply referencing a .dll in your code and NOT installing other software on the server?
I know you can do this with Java and the JT Open toolbox (http://jt400.sourceforge.net/). Why can't you do this with .Net?
Here is a BASIC example of how we currently use the IBM.Data.DB2.iSeries.dll.
String sql = "SELECT 1 FROM SCHEMAX.TABLEX";
System.Data.IDbConnection connection = null;
IDataReader reader = null;
try
{
connection = new iDB2Connection(ConfigurationManager.ConnectionStrings.ConnectionString);
connection.Open();
IDbCommand command = connection.CreateCommand();
command.CommandType = CommandType.Text;
command.CommandText = sql;
reader = command.ExecuteReader();
}
finally
{
try { reader.Close(); } catch (Exception ex) { }
try { connection.Close(); }catch (Exception ex) { }
}
Thanks for your time, welzie