C # Connection DB2 string Oracle Free install client connection string

Source: Internet
Author: User
Tags db2 db2 client

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.