连接到notifyix数据库Windows窗体应用程序
我正在尝试弄清楚如何连接到IBM notifyix数据库。我一直在做一些研究,发现了5年前的一些线程,但是这些示例没有用。
I am trying to figure out how to connect to an IBM informix database. I have been doing some research and have found some threads from 5 years ago but those examples are not working.
我已经安装了IBM最新的SDK来作为notifyix。
I have installed the latest SDK from IBM for informix.
我已经将IBM.Data.Informix.dll包含到我的项目中。
I have included the IBM.Data.Informix.dll to my references in my project.
我已经将使用IBM.Data.Informix;
I have included the using IBM.Data.Informix;
我只是添加一个按钮,然后单击以测试连接。我总是收到此调试错误
SQL0035N文件 C:\Users\Adam\documents\visual studio 2010\Projects\test\test\msg\en_US\db2nmp。 xml无法打开。
I am just adding a button and on click testing the conenction. I always get this debug error "SQL0035N The file "C:\Users\Adam\documents\visual studio 2010\Projects\test\test\msg\en_US\db2nmp.xml" cannot be opened."
此文件不存在,我在Program Files(x86)\IBM Informix Client SDK目录中的任何位置都看不到它。
This file does not exist and I dont see it anywhere in the Program Files (x86)\IBM Informix Client SDK directory.
我的点击代码为
private void button1_Click(object sender, EventArgs e)
{
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";
string ConnectionString = "Host=" + HOST + "; " +
"Service=" + SERVICENUM + "; " +
"Server=" + SERVER + "; " +
"Database=" + DATABASE + "; " +
"User Id=" + USER + "; " +
"Password=" + PASSWORD + "; ";
IfxConnection conn = new IfxConnection();
conn.ConnectionString = ConnectionString;
try
{
conn.Open();
MessageBox.Show("Made connection!");
}
catch (IfxException ex)
{
MessageBox.Show("Problem with connection attempt: " + ex.Message);
}
}
任何人都知道我在做什么或目前做得最好
Anyone know what I am doing wrong or the current best way to connect to informix database?
预先感谢。
我遇到相同的错误,请尝试使用以下格式形成您的字符串:
I was experiencing the same error, try to form your string with the following format:
string ConnectionString = "Server=" + HOST + ":" + SERVICENUM + "; " +
"Database=" + SERVER + "\" + DATABASE + "; " +
"User Id=" + USER + "; " +
"Password=" + PASSWORD + "; ";
使用示例中的值,结果应为:
The result, using the values from your example, should be:
"Server=192.168.OBFUSCATED:1525;Database=serverOBFUSCATED\dbOBFUSCATEDy;User ID=myusername;Password=mypassword;"