远程主机 ”。”没找到错误

时间:2013-07-05 05:13:23

标签: c# .net db2 database-connection

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

  

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

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

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

CODE

   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();

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

连接字符串

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

请参阅No start database manager command was issued error