The following is the DB2 connection database
1) Use IBM.Data.DB2 link DB2 database
2) DB2 client must be installed, IBM. DATA.DB2 can be found in the installed bin.
3) Note The DB2 client version problem, my is WIN7 need V10 version, server win2008 use V9.7 version, WIN7 under V9.7 not installed.
Code
Code
String connectionString = "Server=ip address (can add port number);D atabase= library name; uid= user name; pwd= password; ";
String commandtext = "Select * from Dxloanbal";
Ibm. Data.DB2.DB2Connection connection = new IBM. Data.DB2.DB2Connection (connectionString);
Connection. Open ();
Ibm. Data.DB2.DB2Command command = new IBM. Data.DB2.DB2Command (CommandText, connection);
Ibm. Data.DB2.DB2DataAdapter adapter = new IBM. Data.DB2.DB2DataAdapter (command);
DataSet ds = new DataSet ();
Adapter. Fill (DS);//has passed the test
The following is an Oracle connection database
1) Link Oracle database with DDTek.Oracle.dll Library
2) After adding the DLL library, configure the connection string to access the database.
Code:string ConnectionString = "host= remote host IP; port= port number; User id= database username; password= database password; Service name= library name ";
var conn = new DDTek.Oracle.OracleConnection ();
Conn. ConnectionString = ConnectionString;
Conn. Open ();
var cmd = conn. CreateCommand ();
String sql = @ "SELECT * FROM table";
Cmd.commandtext = SQL;
Cmd. Parameters=commandparameters;
var reader = cmd. ExecuteReader ();
var dtable = new DataTable ("MyTable");
Dtable. Load (reader);//data is populated into the table
C # Connection DB2 string Oracle Free install client connection string