使用.NET连接到Informix [英] Connecting to Informix using .NET
问题描述
服务器信息
Sun Microsystems Inc. SunOS 5.8通用补丁2001年10月
服务器:Informix Dynamic Server版本7.31.UD3
信息:
- 链接:从.Net连接到Informix数据库
- 文章: http://www.ibm.com/developerworks/db2/library/techarticle/ dm-0510durity /
- 我正在运行Visual Studio 2010(C#4.0)。
- 我不在乎是否是ODBC vs OLE DB。
- 我卸载了Informix的所有客户端SDK。我已经准备好要安装的IBM Informix CSDK 3.5(本文在其示例中使用2.9,但我在任何地方找不到它)。
- 我有示例代码从文章。
基本上,我在连接到Informix DB时不成功。我已经删除了所有的客户端SDK的迹象。在这一点上,我不知道该怎么办。我不知道如果我使用正确的版本ConnectionDriver或者,如果我能以某种方式使用DLL和在VS.NET内部设置连接,但似乎没有什么工作。任何帮助只是获得连接工作将是巨大的:
示例代码(来自文章):
使用System;
使用IBM.Data.Informix;
命名空间IfxAdoPres.Basics {
public class BasicConnection {
const string HOST =192.168.OBFUSCATED;
const string SERVICENUM =1525; //港口?
const string SERVER =serverOBFUSCATED;
const string DATABASE =dbOBFUSCATEDy;
const string USER =myusername;
const string PASSWORD =mypassword;
public IfxConnection conn = new IfxConnection();
public BasicConnection(){}
public void MakeConnection()
{
string ConnectionString =
Host =+ HOST + ;+
Service =+ SERVICENUM +;+
Server =+ SERVER +;+
Database =+ DATABASE +;+
User Id =+ USER +;+
Password =+ PASSWORD +;;
conn.ConnectionString = ConnectionString;
try
{
conn.Open();
Console.WriteLine(Made connection!);
}
catch(IfxException ex)
{
Console.WriteLine(e.ToString());
}
Console.ReadLine();
}
public void CloseConnection()
{
conn.Close();
}
}
}
所有它是一个新的重新安装...删除所有的旧驱动程序,并安装了一个全新的3.5 CSDK,然后使用的演示代码从文章,并使用Setnet32配置我的连接。
Server Information
Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001
Server: Informix Dynamic Server Version 7.31.UD3
Information:
- Link: Connecting to Informix database from .Net
- Article: http://www.ibm.com/developerworks/db2/library/techarticle/dm-0510durity/
- I am running Visual Studio 2010 (C# 4.0).
- I don't care if it is ODBC vs OLE DB.
- I uninstalled all the client SDKs for Informix. I have readily available the IBM Informix CSDK 3.5 ready to be installed (the article uses 2.9 in its example, but I can't find that anywhere).
- I have the sample code from the article.
Basically, I was unsuccessful at connecting to the Informix DB. I have since removed all signs of the Client SDK. At this point, I have no idea what to do. I don't know if I'm using the right version ConnectionDriver or not, or if I can somehow use a dll and setup the connection internally in VS.NET, but nothing seems to work. Any help just getting a connection to work would be great:
Sample Code (From the article):
using System;
using IBM.Data.Informix;
namespace IfxAdoPres.Basics {
public class BasicConnection {
const string HOST = "192.168.OBFUSCATED";
const string SERVICENUM = "1525"; //Port?
const string SERVER = "serverOBFUSCATED";
const string DATABASE = "dbOBFUSCATEDy";
const string USER = "myusername";
const string PASSWORD = "mypassword";
public IfxConnection conn = new IfxConnection();
public BasicConnection() {}
public void MakeConnection()
{
string ConnectionString =
"Host = " + HOST + "; " +
"Service=" + SERVICENUM + "; " +
"Server=" + SERVER + "; " +
"Database=" + DATABASE + "; " +
"User Id=" + USER + "; " +
"Password=" + PASSWORD + "; ";
conn.ConnectionString = ConnectionString;
try
{
conn.Open();
Console.WriteLine("Made connection!");
}
catch (IfxException ex)
{
Console.WriteLine(e.ToString());
}
Console.ReadLine();
}
public void CloseConnection()
{
conn.Close();
}
}
}
All it took was a fresh reinstall... removed all the old drivers and installed a fresh new 3.5 CSDK, then used the demo code from the article and used the Setnet32 to configure my connection.
这篇关于使用.NET连接到Informix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!