3

尝试连接 DB2 数据库时出现以下错误。

SQL1336N 远程主机“。” 没找到。SQLSTATE=08001

DB2 Express 安装在我的本地机器上,并使用命令窗口在数据库中创建了一些表。

克服此错误的主机名应该是什么?

代码

   string connectionString= @"Provider = IBMDADB2; Database = MYDATABASE; Hostname = .; Protocol = TCPIP; Port = 50000; Uid = xxx123; Pwd = dddd@454";
   OleDbConnection myConnection = new OleDbConnection();
   myConnection.ConnectionString = connectionString;
   myConnection.Open();
4

2 回答 2

3

也许您应该尝试将主机名设置为本地 ip 或“localhost”。

于 2013-07-05T08:13:01.837 回答
0

连接字符串

"Provider = IBMDADB2; Database = TIMS; Hostname = localhost; Protocol = TCPIP; Port = 50010; Uid = myUserID; Pwd = myPassword";

也参考No start database manager command was sent 错误

于 2013-07-10T06:00:42.133 回答