Informix Database Connection String in C#

In this article, I have listed C# code snippets of connection string for Informix Database.


Informix Database Connection String in C#:

Connection String provide the required information to the driver that tells where to find the default connection information. Optionally, you are allowed to specify attribute=value pairs in the connection string to override the default values stored in the data source.

1. ODBC DSN – INFORMIX 3.30 ODBC Driver

using System.Data.Odbc;
var conn = new OdbcConnection();
conn.ConnectionString = 
              "Dsn=DsnName;" + 
              "Host=HostName;" + 
              "Server=ServerName;" + 
              "Service=ServerName;" + 
              "Protocol=olsoctcp;" + 
              "Database=DataBaseName;" + 
              "Uid=UserName;" + 
              "Pwd=Secret;"; 
conn.Open();

2. ODBC without DSN – INFORMIX 3.30 ODBC Driver

using System.Data.Odbc;
var conn = new OdbcConnection();
conn.ConnectionString = 
              "Dsn="";" + 
              "Driver={INFORMIX 3.30 32 BIT};" + 
              "Host=HostName;" + 
              "Server=ServerName;" + 
              "Service=ServerName;" + 
              "Protocol=olsoctcp;" + 
              "Database=DataBaseName;" + 
              "Uid=UserName;" + 
              "Pwd=Secret;"; 
conn.Open();

3. ODBC Informix-CLI 2.5 ODBC Driver

using System.Data.Odbc;
var conn = new OdbcConnection();
conn.ConnectionString = 
          "Driver={Informix-CLI 2.5 (32 Bit)};" + 
          "Server=ServerName;" + 
          "DataBase=DataBaseName;" + 
          "Uid=UserName;" + 
          "Pwd=Secret;"; 
conn.Open();

4. OleDb – IBM Informix OleDb Provider

using System.Data.OleDb;
var conn = new OleDbConnection();
conn.ConnectionString = 
        "Driver=IFXOLEDBC;" + 
        "Data Source=DataBaseName@ServerName;" + 
        "User id=UserName;" + 
        "Password=Secret;"; 
        "Persist Security Info=true;"; 
conn.Open();


– Article ends here –

If you have any questions, please feel free to share your questions or comments on the comment box below.

Recommended:   Singleton design pattern in C#
Share this:
We will be happy to hear your thoughts

Leave a reply

Troubleshootyourself
Logo